Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-delta-r-sq-mc.R
DeltaRSqMC.Rd
Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Usage
DeltaRSqMC(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 \(\Delta R^{2}\).
- vcov
Sampling variance-covariance matrix of \(\Delta R^{2}\).
- est
Vector of estimated \(\Delta R^{2}\).
- fun
Function used ("DeltaRSqMC").
Details
The vector of improvement in R-squared (\(\Delta R^{2}\)) 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 \(\Delta R^{2}\), 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
)
# DeltaRSqMC ---------------------------------------------------------------
out <- DeltaRSqMC(mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(out)
#> Call:
#> DeltaRSqMC(object = mc, alpha = 0.05)
#>
#> Improvement in R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.1859 0.0673 100 0.0527 0.3163
#> PCTGRT 0.1177 0.0496 100 0.0272 0.2156
#> PCTSUPP 0.0569 0.0323 100 0.0079 0.1274
summary(out)
#> Call:
#> DeltaRSqMC(object = mc, alpha = 0.05)
#>
#> Improvement in R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.1859 0.0673 100 0.0527 0.3163
#> PCTGRT 0.1177 0.0496 100 0.0272 0.2156
#> PCTSUPP 0.0569 0.0323 100 0.0079 0.1274
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.1858925 0.1176542 0.0568722
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0045232624 0.0005521534 -0.0001510877
#> PCTGRT 0.0005521534 0.0024592635 -0.0002500184
#> PCTSUPP -0.0001510877 -0.0002500184 0.0010413251
confint(out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.052718279 0.3162597
#> PCTGRT 0.027238743 0.2156250
#> PCTSUPP 0.007917799 0.1273978