rstanarm_tidiers {broom} | R Documentation |
rstanarm
tidiers will soon be deprecated in broom
and there is no
ongoing development of these functions at this time.
## S3 method for class 'stanreg' tidy(x, parameters = "non-varying", intervals = FALSE, prob = 0.9, ...) ## S3 method for class 'stanreg' glance(x, looic = FALSE, ...)
x |
Fitted model object from the rstanarm package. See
|
parameters |
One or more of |
intervals |
If |
prob |
|
... |
For |
looic |
Should the LOO Information Criterion (and related info) be
included? See |
These methods tidy the estimates from rstanarm::stanreg-objects()
(fitted model objects from the rstanarm package) into a summary.
All tidying methods return a data.frame
without rownames.
The structure depends on the method chosen.
When parameters="non-varying"
(the default), tidy.stanreg
returns
one row for each coefficient, with three columns:
term |
The name of the corresponding term in the model. |
estimate |
A point estimate of the coefficient (posterior median). |
std.error |
A standard error for the point estimate based on
|
For models with group-specific parameters (e.g., models fit with
rstanarm::stan_glmer()
), setting parameters="varying"
selects the group-level parameters instead of the non-varying regression
coefficients. Additional columns are added indicating the level
and
group
. Specifying parameters="hierarchical"
selects the
standard deviations and (for certain models) correlations of the group-level
parameters.
Setting parameters="auxiliary"
will select parameters other than those
included by the other options. The particular parameters depend on which
rstanarm modeling function was used to fit the model. For example, for
models fit using rstanarm::stan_glm.nb()
the overdispersion
parameter is included if parameters="aux"
, for
rstanarm::stan_lm()
the auxiliary parameters include the residual
SD, R^2, and log(fit_ratio), etc.
If intervals=TRUE
, columns for the lower
and upper
values of the posterior intervals computed with
rstanarm::posterior_interval()
are also included.
glance
returns one row with the columns
algorithm |
The algorithm used to fit the model. |
pss |
The posterior sample size (except for models fit using optimization). |
nobs |
The number of observations used to fit the model. |
sigma |
The square root of the estimated residual variance, if
applicable. If not applicable (e.g., for binomial GLMs), |
If looic=TRUE
, then the following additional columns are also
included:
looic |
The LOO Information Criterion. |
elpd_loo |
The expected log predictive density ( |
p_loo |
The effective number of parameters. |
## Not run: fit <- stan_glmer(mpg ~ wt + (1|cyl) + (1+wt|gear), data = mtcars, iter = 300, chains = 2) # non-varying ("population") parameters tidy(fit, intervals = TRUE, prob = 0.5) # hierarchical sd & correlation parameters tidy(fit, parameters = "hierarchical") # group-specific deviations from "population" parameters tidy(fit, parameters = "varying") # glance method glance(fit) glance(fit, looic = TRUE, cores = 1) ## End(Not run)