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.0689 100 0.0382 0.3163
#> PCTGRT 0.1177 0.0534 100 0.0159 0.2262
#> PCTSUPP 0.0569 0.0350 100 0.0083 0.1469
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.0689 100 0.0382 0.3163
#> PCTGRT 0.1177 0.0534 100 0.0159 0.2262
#> PCTSUPP 0.0569 0.0350 100 0.0083 0.1469
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.1858925 0.1176542 0.0568722
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0047494687 0.0006929034 -0.0002156097
#> PCTGRT 0.0006929034 0.0028508844 -0.0002789105
#> PCTSUPP -0.0002156097 -0.0002789105 0.0012218360
confint(out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.038244504 0.3162501
#> PCTGRT 0.015862039 0.2261563
#> PCTSUPP 0.008251746 0.1468580