confint.std_selected {stdmod} | R Documentation |
Confidence Intervals for a 'std_selected' Class Object
Description
Return the confidence intervals of estimates
in the output of std_selected()
or std_selected_boot()
.
Usage
## S3 method for class 'std_selected'
confint(object, parm, level = 0.95, type, ...)
Arguments
object |
The output of |
parm |
The parameters (coefficients) for which confidence intervals should be returned. If missing, the confidence intervals of all parameters will be returned. |
level |
The level of confidence. For the confidence intervals returned
by |
type |
The type of the confidence intervals. If est to |
... |
Arguments to be passed to |
Details
If bootstrapping is used to form the confidence interval by
std_selected_boot()
,
users can request the percentile confidence intervals of
the bootstrap estimates. This method does not do the bootstrapping itself.
Value
A matrix of the confidence intervals.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
Examples
# Load a sample data set
dat <- test_x_1_w_1_v_1_cat1_n_500
# Do a moderated regression by lm
lm_raw <- lm(dv ~ iv*mod + v1 + cat1, dat)
summary(lm_raw)
# Standardize all variables except for categorical variables.
# Interaction terms are formed after standardization.
lm_std <- std_selected(lm_raw, to_center = ~ .,
to_scale = ~ .)
# Alternative: use to_standardize as a shortcut
# lm_std <- std_selected(lm_raw, to_standardize = ~ .)
summary(lm_std)
confint(lm_std)
# Use to_standardize as a shortcut
lm_std2 <- std_selected(lm_raw, to_standardize = ~ .)
# The results are the same
confint(lm_std)
confint(lm_std2)
all.equal(confint(lm_std), confint(lm_std2))
# With bootstrapping
# nboot = 100 just for illustration. nboot >= 2000 should be used in read
# research.
set.seed(89572)
lm_std_boot <- std_selected_boot(lm_raw, to_scale = ~ .,
to_center = ~ .,
nboot = 100)
summary(lm_std_boot)
# Bootstrap percentile intervals, default when bootstrap was conduced
confint(lm_std_boot)
# Force OLS confidence intervals
confint(lm_std_boot, type = "lm")
# Use to_standardize as a shortcut
set.seed(89572)
lm_std_boot2 <- std_selected_boot(lm_raw, to_standardize = ~ .,
nboot = 100)
# The results are the same
confint(lm_std_boot)
confint(lm_std_boot2)
all.equal(confint(lm_std_boot), confint(lm_std_boot2))