Estimate Differences of Standardized Slopes and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-diff-beta-mc.R
DiffBetaMC.Rd
Estimate Differences of Standardized Slopes 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.
Examples
# Data ---------------------------------------------------------------------
data("nas1982", package = "betaMC")
# Fit Model in lm ----------------------------------------------------------
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982)
# MC -----------------------------------------------------------------------
mc <- MC(
object,
R = 100, # use a large value e.g., 20000L for actual research
seed = 0508
)
# DiffBetaMC ---------------------------------------------------------------
out <- DiffBetaMC(mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(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.1296 100 -0.1366 0.3402
#> NARTIC-PCTSUPP 0.2319 0.1288 100 -0.0081 0.4676
#> PCTGRT-PCTSUPP 0.1282 0.1256 100 -0.1156 0.3734
summary(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.1296 100 -0.1366 0.3402
#> NARTIC-PCTSUPP 0.2319 0.1288 100 -0.0081 0.4676
#> PCTGRT-PCTSUPP 0.1282 0.1256 100 -0.1156 0.3734
coef(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> 0.1036564 0.2318974 0.1282410
vcov(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.016806528 0.008807174 -0.007999355
#> NARTIC-PCTSUPP 0.008807174 0.016590325 0.007783151
#> PCTGRT-PCTSUPP -0.007999355 0.007783151 0.015782506
confint(out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.136563743 0.3402320
#> NARTIC-PCTSUPP -0.008099405 0.4676292
#> PCTGRT-PCTSUPP -0.115552550 0.3733956