View source: R/print-and-summary.R
summary.stanreg | R Documentation |
Summaries of parameter estimates and MCMC convergence diagnostics (Monte Carlo error, effective sample size, Rhat).
## S3 method for class 'stanreg'
summary(
object,
pars = NULL,
regex_pars = NULL,
probs = c(0.1, 0.5, 0.9),
...,
digits = 1
)
## S3 method for class 'summary.stanreg'
print(x, digits = max(1, attr(x, "print.digits")), ...)
## S3 method for class 'summary.stanreg'
as.data.frame(x, ...)
## S3 method for class 'stanmvreg'
summary(object, pars = NULL, regex_pars = NULL, probs = NULL, ..., digits = 3)
## S3 method for class 'summary.stanmvreg'
print(x, digits = max(1, attr(x, "print.digits")), ...)
object |
A fitted model object returned by one of the
rstanarm modeling functions. See |
pars |
An optional character vector specifying a subset of parameters to
display. Parameters can be specified by name or several shortcuts can be
used. Using In addition, for If |
regex_pars |
An optional character vector of regular
expressions to use for parameter selection. |
probs |
For models fit using MCMC or one of the variational algorithms,
an optional numeric vector of probabilities passed to
|
... |
Currently ignored. |
digits |
Number of digits to use for formatting numbers when printing.
When calling |
x |
An object of class |
Summary statistics are also reported for mean_PPD
, the sample
average posterior predictive distribution of the outcome. This is useful as a
quick diagnostic. A useful heuristic is to check if mean_PPD
is
plausible when compared to mean(y)
. If it is plausible then this does
not mean that the model is good in general (only that it can reproduce
the sample mean), however if mean_PPD
is implausible then it is a sign
that something is wrong (severe model misspecification, problems with the
data, computational issues, etc.).
The summary
method returns an object of class
"summary.stanreg"
(or "summary.stanmvreg"
, inheriting
"summary.stanreg"
), which is a matrix of
summary statistics and
diagnostics, with attributes storing information for use by the
print
method. The print
method for summary.stanreg
or
summary.stanmvreg
objects is called for its side effect and just returns
its input. The as.data.frame
method for summary.stanreg
objects converts the matrix to a data.frame, preserving row and column
names but dropping the print
-related attributes.
prior_summary
to extract or print a summary of the
priors used for a particular model.
if (.Platform$OS.type != "windows" || .Platform$r_arch != "i386") {
if (!exists("example_model")) example(example_model)
summary(example_model, probs = c(0.1, 0.9))
# These produce the same output for this example,
# but the second method can be used for any model
summary(example_model, pars = c("(Intercept)", "size",
paste0("period", 2:4)))
summary(example_model, pars = c("alpha", "beta"))
# Only show parameters varying by group
summary(example_model, pars = "varying")
as.data.frame(summary(example_model, pars = "varying"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.