vcov.std_selected {stdmod} | R Documentation |
The 'vcov' Method for a 'std_selected' Class Object
Description
Compute the variance-covariance matrix
of estimates in the output of std_selected()
or
std_selected_boot()
.
Usage
## S3 method for class 'std_selected'
vcov(object, type, ...)
Arguments
object |
The output of |
type |
The type of variance-covariance matrix. If set to |
... |
Arguments to be passed to |
Details
If bootstrapping was used to form the confidence intervals, users can request the variance-covariance matrix of the bootstrap estimates.
Value
A matrix of the variances and covariances of the parameter estimates.
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
head(dat)
# Do a moderated regression by lm
lm_raw <- lm(dv ~ iv*mod + v1 + cat1, dat)
# Standardize all variables except for categorical variables.
# Interaction terms are formed after standardization.
lm_std <- std_selected(lm_raw, to_scale = ~ .,
to_center = ~ .)
# VCOV of lm output
vcov(lm_std)
# Standardize all variables as in std_selected above, and compute the
# nonparametric bootstrapping percentile confidence intervals.
lm_std_boot <- std_selected_boot(lm_raw,
to_scale = ~ .,
to_center = ~ .,
conf = .95,
nboot = 100)
# In real analysis, nboot should be at least 2000.
# VCOV of bootstrap estimates, default when bootstrap was conducted
vcov(lm_std_boot)
# For OLS VCOV
vcov(lm_std_boot, type = "lm")