Estimate Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-beta-mc.R
BetaMC.RdEstimate Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Usage
BetaMC(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)Arguments
- object
Object of class
mc, that is, the output of theMC()function.- alpha
Numeric vector. Significance level \(\alpha\).
- std_y
Logical. Standardize \(y\).
- std_x
Character vector or
NULL. Names of the regressors to standardize.NULL(default) standardizes all regressors;character(0)standardizes none.
Value
Returns an object
of class betamc which is a list with the following elements:
- call
Function call.
- args
Function arguments.
- thetahatstar
Sampling distribution of \(\boldsymbol{\hat{\beta}}\).
- vcov
Sampling variance-covariance matrix of \(\boldsymbol{\hat{\beta}}\).
- est
Vector of estimated \(\boldsymbol{\hat{\beta}}\).
- fun
Function used ("BetaMC").
Details
By default, both \(y\) and the regressors are standardized.
With std_y = FALSE, \(y\) is left in its original units
(\(b_j \sigma_{x_j}\));
with std_x, only the named regressors are standardized
(for example, std_x = character(0) gives \(b_j / \sigma_y\),
and leaving a dummy variable out of std_x keeps its 0-1 contrast).
The standard deviations are taken from each draw.
The vector of standardized regression coefficients (\(\boldsymbol{\hat{\beta}}\)) is derived from each randomly generated vector of parameter estimates. Confidence intervals are generated by obtaining percentiles corresponding to \(100(1 - \alpha)\%\) from the generated sampling distribution of \(\boldsymbol{\hat{\beta}}\), where \(\alpha\) is the significance level.
From the regression parameters
\(\boldsymbol{\theta} = \left\{ \boldsymbol{b}, \sigma^{2},
\operatorname{vech} \left( \boldsymbol{\Sigma}_{\boldsymbol{X}
\boldsymbol{X}} \right) \right\}\) of each draw (see MC()),
the variance of the outcome and the standardized regression slopes are
$$\sigma^{2}_{y} = \boldsymbol{b}^{\prime}
\boldsymbol{\Sigma}_{\boldsymbol{X} \boldsymbol{X}} \boldsymbol{b} +
\sigma^{2}, \quad \beta^{\ast}_{j} = b_{j}
\frac{\sigma_{x_{j}}}{\sigma_{y}},$$
where \(\sigma_{x_{j}}\) is the square root of the \(j\)th diagonal
element of \(\boldsymbol{\Sigma}_{\boldsymbol{X} \boldsymbol{X}}\).
The estimates are computed from the fitted model,
the draws \(\hat{\boldsymbol{\beta}}^{\ast}_{r}\) from each Monte Carlo
draw, and vcov is the sample covariance matrix of the draws.
The percentile interval is
\(\left[ \hat{G}^{-1} \left( \alpha / 2 \right), \hat{G}^{-1} \left( 1 -
\alpha / 2 \right) \right]\),
where \(\hat{G}\) is the empirical distribution function of the draws.
References
Dudgeon, P. (2017). Some improvements in confidence intervals for standardized regression coefficients. Psychometrika, 82(4), 928–951. doi:10.1007/s11336-017-9563-z
MacKinnon, D. P., Lockwood, C. M., & Williams, J. (2004). Confidence limits for the indirect effect: Distribution of the product and resampling methods. Multivariate Behavioral Research, 39(1), 99–128. doi:10.1207/s15327906mbr3901_4
Pesigan, I. J. A., & Cheung, S. F. (2024). Monte Carlo confidence intervals for the indirect effect with missing data. Behavior Research Methods. doi:10.3758/s13428-023-02114-4
Preacher, K. J., & Selig, J. P. (2012). Advantages of Monte Carlo confidence intervals for indirect effects. Communication Methods and Measures, 6(2), 77–98. doi:10.1080/19312458.2012.679848
See also
Other Beta Monte Carlo Functions:
DeltaRSqMC(),
DiffBetaMC(),
FSqMC(),
MC(),
MCMI(),
PCorMC(),
RSqMC(),
SCorMC(),
SCorSqMC()
Examples
# Data ---------------------------------------------------------------------
data("nas1982", package = "betaMC")
# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
data = nas1982
)
# MC -----------------------------------------------------------------------
mc <- MC(
object = object,
R = 100, # use a large value e.g., 20000L for actual research
seed = 0508
)
# BetaMC -------------------------------------------------------------------
out <- BetaMC(object = mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(x = out)
#> Call:
#> BetaMC(object = mc, alpha = 0.05)
#>
#> Standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4951 0.0805 100 0.3107 0.6135
#> PCTGRT 0.3915 0.0810 100 0.2495 0.5347
#> PCTSUPP 0.2632 0.0730 100 0.1307 0.4055
summary(object = out)
#> Call:
#> BetaMC(object = mc, alpha = 0.05)
#>
#> Standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4951 0.0805 100 0.3107 0.6135
#> PCTGRT 0.3915 0.0810 100 0.2495 0.5347
#> PCTSUPP 0.2632 0.0730 100 0.1307 0.4055
coef(object = out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4951451 0.3914887 0.2632477
vcov(object = out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.006474424 -0.003611896 -0.002023361
#> PCTGRT -0.003611896 0.006565249 -0.001581942
#> PCTSUPP -0.002023361 -0.001581942 0.005336272
confint(object = out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.3106786 0.6134972
#> PCTGRT 0.2494813 0.5346903
#> PCTSUPP 0.1306721 0.4055249