Learn R Programming

bssm (version 2.0.2)

summary.mcmc_output: Summary Statistics of Posterior Samples

Description

This functions returns a data frame containing mean, standard deviations, standard errors, and effective sample size estimates for parameters and states.

Usage

# S3 method for mcmc_output
summary(
  object,
  return_se = FALSE,
  variable = "theta",
  probs = c(0.025, 0.975),
  times,
  states,
  use_times = TRUE,
  method = "sokal",
  ...
)

Value

If variable is "theta" or "states", a data.frame object. If "both", a list of two data frames.

Arguments

object

Output from run_mcmc

return_se

if FALSE (default), computation of standard errors and effective sample sizes is omitted (as they can take considerable time for models with large number of states and time points).

variable

Are the summary statistics computed for either "theta" (default), "states", or "both"?

probs

A numeric vector defining the quantiles of interest. Default is c(0.025, 0.975).

times

A vector of indices. For states, for what time points the summaries should be computed? Default is all, ignored if variable = "theta".

states

A vector of indices. For what states the summaries should be computed?. Default is all, ignored if variable = "theta".

use_times

If TRUE (default), transforms the values of the time variable to match the ts attribute of the input to define. If FALSE, time is based on the indexing starting from 1.

method

Method for computing integrated autocorrelation time. Default is "sokal", other option is "geyer".

...

Ignored.

Details

For IS-MCMC two types of standard errors are reported. SE-IS can be regarded as the square root of independent IS variance, whereas SE corresponds to the square root of total asymptotic variance (see Remark 3 of Vihola et al. (2020)).

References

Vihola, M, Helske, J, Franks, J. Importance sampling type estimators based on approximate marginal Markov chain Monte Carlo. Scand J Statist. 2020; 1-38. https://doi.org/10.1111/sjos.12492

Examples

Run this code
data("negbin_model")
summary(negbin_model, return_se = TRUE, method = "geyer")
summary(negbin_model, times = c(1, 200), prob = c(0.05, 0.5, 0.95))

Run the code above in your browser using DataLab