Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stanfit-method-summary

Summary method for stanfit objects


Description

Summarize the distributions of estimated parameters and derived quantities using the posterior draws.

Usage

## S4 method for signature 'stanfit'
summary(object, pars, probs = c(0.025, 0.25, 0.50, 0.75, 0.975),
  use_cache = TRUE, ...)

Arguments

object

An instance of class stanfit.

pars

A character vector of parameter names. Defaults to all parameters as well as the log-posterior (lp__).

probs

A numeric vector of quantiles of interest. The default is c(0.025,0.25,0.5,0.75,0.975).

use_cache

Logical, defaulting to TRUE. When use_cache=TRUE the summary quantities for all parameters are computed and cached for future use. Setting use_cache=FALSE can be used to avoid performing the summary computations for all parameters if pars is given as some specific parameters.

...

Currently unused.

Value

The summary method returns a named list with elements summary and c_summary, which contain summaries for for all chains merged and individual chains, respectively. Included in the summaries are quantiles, means, standard deviations (sd), effective sample sizes (n_eff), and split Rhats (the potential scale reduction derived from all chains after splitting each chain in half and treating the halves as chains). For the summary of all chains merged, Monte Carlo standard errors (se_mean) are also reported.

See Also

  • monitor, which computes similar summaries but accepts an array of MCMC draws as its input rather than a stanfit object.

  • The RStan vignettes for more example usage.

Examples

## Not run: 
ecode <- '
  parameters {
    real<lower=0> y[2];
  } 
  model {
    y ~ exponential(1);
  }
'
fit <- stan(model_code = ecode)
s <- summary(fit, probs = c(0.1, 0.9))
s$summary  # all chaines merged
s$c_summary  # individual chains

## End(Not run)

rstan

R Interface to Stan

v2.21.2
GPL (>= 3)
Authors
Jiqiang Guo [aut], Jonah Gabry [aut], Ben Goodrich [cre, aut], Sebastian Weber [aut], Daniel Lee [ctb], Krzysztof Sakrejda [ctb], Modrak Martin [ctb], Trustees of Columbia University [cph], Oleg Sklyar [cph] (R/cxxfunplus.R), The R Core Team [cph] (R/pairs.R, R/dynGet.R), Jens Oehlschlaegel-Akiyoshi [cph] (R/pairs.R), John Maddock [cph] (gamma.hpp), Paul Bristow [cph] (gamma.hpp), Nikhar Agrawal [cph] (gamma.hpp), Christopher Kormanyos [cph] (gamma.hpp), Bronder Steve [ctb]
Initial release
2020-07-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.