Summarise parameter estimates and model diagnostics.

# S3 method for mcpfit
summary(object, width = 0.95, digits = 2, prior = FALSE, ...)

fixef(object, width = 0.95, prior = FALSE, ...)

ranef(object, width = 0.95, prior = FALSE, ...)

# S3 method for mcpfit
print(x, ...)

Arguments

object

An mcpfit object.

width

Float. The width of the highest posterior density interval (between 0 and 1).

digits

a non-null value for digits specifies the minimum number of significant digits to be printed in values. The default, NULL, uses getOption("digits"). (For the interpretation for complex numbers see signif.) Non-integer values will be rounded down, and only values greater than or equal to 1 and no greater than 22 are accepted.

prior

TRUE/FALSE. Summarise prior instead of posterior?

...

Currently ignored

x

An mcpfit object.

Value

A data frame with parameter estimates and MCMC diagnostics. OBS: The change point distributions are often not unimodal and symmetric so the intervals can be deceiving Plot them using plot_pars(fit).

  • mean is the posterior mean

  • lower is the lower quantile of the highest-density interval (HDI) given in width.

  • upper is the upper quantile.

  • Rhat is the Gelman-Rubin convergence diagnostic which is often taken to be acceptable if < 1.1. It is computed using gelman.diag.

  • n.eff is the effective sample size computed using effectiveSize. Low effective sample sizes are also obvious as poor mixing in trace plots (see plot_pars(fit)). Read how to deal with such problems here

  • ts_err is the time-series error, taking autoregressive correlation into account. It is computed using spectrum0.ar.

For simulated data, the summary contains two additional columns so that it is easy to inspect whether the model can recover the parameters. Run simulation and summary multiple times to get a sense of the robustness.

  • sim is the value used to generate the data.

  • match is "OK" if sim is contained in the HDI interval (lower to upper).

Functions

  • fixef: Get population-level ("fixed") effects of an mcpfit object.

  • ranef: Get varying ("random") effects of an mcpfit object.

  • print.mcpfit: Print the posterior summary of an mcpfit object.

Examples

# Typical usage
summary(ex_fit)
summary(ex_fit, width = 0.8, digits = 4)  # Set HDI width

# Get the results as a data frame
results = summary(ex_fit)

# Varying (random) effects
# ranef(my_fit)

# Summarise prior
summary(ex_fit, prior = TRUE)