Estimate Differences of Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-diff-beta-mc.R
DiffBetaMC.RdEstimate Differences of Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Usage
DiffBetaMC(object, alpha = c(0.05, 0.01, 0.001))Arguments
- object
Object of class
mc, that is, the output of theMC()function.- alpha
Numeric vector. Significance level \(\alpha\).
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 differences of standardized regression slopes.
- vcov
Sampling variance-covariance matrix of differences of standardized regression slopes.
- est
Vector of estimated differences of standardized regression slopes.
- fun
Function used ("DiffBetaMC").
Details
The vector of differences of standardized regression slopes 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 differences of standardized regression slopes, where \(\alpha\) is the significance level.
For every pair of regressors \(j < l\),
the difference of the standardized regression slopes (see BetaMC()) is
$$\Delta \beta^{\ast}_{jl} = \beta^{\ast}_{j} - \beta^{\ast}_{l},$$
computed from the fitted model for the estimate
and from each Monte Carlo draw (see MC()) for the draws.
See also
Other Beta Monte Carlo Functions:
BetaMC(),
DeltaRSqMC(),
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
)
# DiffBetaMC ---------------------------------------------------------------
out <- DiffBetaMC(object = mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(x = out)
#> Call:
#> DiffBetaMC(object = mc, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1423 100 -0.2197 0.3226
#> NARTIC-PCTSUPP 0.2319 0.1259 100 0.0086 0.4450
#> PCTGRT-PCTSUPP 0.1282 0.1227 100 -0.1243 0.3683
summary(object = out)
#> Call:
#> DiffBetaMC(object = mc, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1423 100 -0.2197 0.3226
#> NARTIC-PCTSUPP 0.2319 0.1259 100 0.0086 0.4450
#> PCTGRT-PCTSUPP 0.1282 0.1227 100 -0.1243 0.3683
coef(object = out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> 0.1036564 0.2318974 0.1282410
vcov(object = out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.020263465 0.01052774 -0.009735726
#> NARTIC-PCTSUPP 0.010527739 0.01585742 0.005329680
#> PCTGRT-PCTSUPP -0.009735726 0.00532968 0.015065406
confint(object = out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.219742529 0.3226100
#> NARTIC-PCTSUPP 0.008557881 0.4450363
#> PCTGRT-PCTSUPP -0.124328414 0.3683061