View source: R/simulate_parameters.R
simulate_parameters.glmmTMB | R Documentation |
Compute simulated draws of parameters and their related indices such as Confidence Intervals (CI) and p-values. Simulating parameter draws can be seen as a (computationally faster) alternative to bootstrapping.
## S3 method for class 'glmmTMB'
simulate_parameters(
model,
iterations = 1000,
centrality = "median",
ci = 0.95,
ci_method = "quantile",
test = "p-value",
...
)
simulate_parameters(model, ...)
## Default S3 method:
simulate_parameters(
model,
iterations = 1000,
centrality = "median",
ci = 0.95,
ci_method = "quantile",
test = "p-value",
...
)
model |
Statistical model (no Bayesian models). |
iterations |
The number of draws to simulate/bootstrap. |
centrality |
The point-estimates (centrality indices) to compute. Character
(vector) or list with one or more of these options: |
ci |
Value or vector of probability of the CI (between 0 and 1)
to be estimated. Default to |
ci_method |
The type of index used for Credible Interval. Can be |
test |
The indices of effect existence to compute. Character (vector) or
list with one or more of these options: |
... |
Arguments passed to |
simulate_parameters()
is a computationally faster alternative
to bootstrap_parameters()
. Simulated draws for coefficients are based
on a multivariate normal distribution (MASS::mvrnorm()
) with mean
mu = coef(model)
and variance Sigma = vcov(model)
.
For models from packages glmmTMB, pscl, GLMMadaptive and
countreg, the component
argument can be used to specify
which parameters should be simulated. For all other models, parameters
from the conditional component (fixed effects) are simulated. This may
include smooth terms, but not random effects.
A data frame with simulated parameters.
There is also a plot()
-method implemented in the see-package.
Gelman A, Hill J. Data analysis using regression and multilevel/hierarchical models. Cambridge; New York: Cambridge University Press 2007: 140-143
bootstrap_model()
, bootstrap_parameters()
, simulate_model()
model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris)
simulate_parameters(model)
if (require("glmmTMB", quietly = TRUE)) {
model <- glmmTMB(
count ~ spp + mined + (1 | site),
ziformula = ~mined,
family = poisson(),
data = Salamanders
)
simulate_parameters(model, centrality = "mean")
simulate_parameters(model, ci = c(.8, .95), component = "zero_inflated")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.