View source: R/bootstrap_parameters.R
bootstrap_parameters | R Documentation |
Compute bootstrapped parameters and their related indices such as Confidence Intervals (CI) and p-values.
bootstrap_parameters(model, ...)
## Default S3 method:
bootstrap_parameters(
model,
iterations = 1000,
centrality = "median",
ci = 0.95,
ci_method = "quantile",
test = "p-value",
...
)
model |
Statistical model. |
... |
Arguments passed to other methods, like |
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 to compute. Character (vector) with one or more of
these options: |
This function first calls bootstrap_model()
to generate
bootstrapped coefficients. The resulting replicated for each coefficient
are treated as "distribution", and is passed to bayestestR::describe_posterior()
to calculate the related indices defined in the "test"
argument.
Note that that p-values returned here are estimated under the assumption of translation equivariance: that shape of the sampling distribution is unaffected by the null being true or not. If this assumption does not hold, p-values can be biased, and it is suggested to use proper permutation tests to obtain non-parametric p-values.
A data frame summarizing the bootstrapped parameters.
The output can be passed directly to the various functions from the
emmeans package, to obtain bootstrapped estimates, contrasts, simple
slopes, etc. and their confidence intervals. These can then be passed to
model_parameter()
to obtain standard errors, p-values, etc. (see
example).
Note that that p-values returned here are estimated under the assumption of translation equivariance: that shape of the sampling distribution is unaffected by the null being true or not. If this assumption does not hold, p-values can be biased, and it is suggested to use proper permutation tests to obtain non-parametric p-values.
Davison, A. C., & Hinkley, D. V. (1997). Bootstrap methods and their application (Vol. 1). Cambridge university press.
bootstrap_model()
, simulate_parameters()
, simulate_model()
set.seed(2)
model <- lm(Sepal.Length ~ Species * Petal.Width, data = iris)
b <- bootstrap_parameters(model)
print(b)
# different type of bootstrapping
set.seed(2)
b <- bootstrap_parameters(model, type = "balanced")
print(b)
est <- emmeans::emmeans(b, trt.vs.ctrl ~ Species)
print(model_parameters(est))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.