Estimate R-Squared and Adjusted R-Squared and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-r-sq-mc.R
RSqMC.RdEstimate R-Squared and Adjusted R-Squared and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Usage
RSqMC(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 \(R^{2}\) and \(\bar{R}^{2}\).
- vcov
Sampling variance-covariance matrix of \(R^{2}\) and \(\bar{R}^{2}\).
- est
Vector of estimated \(R^{2}\) and \(\bar{R}^{2}\).
- fun
Function used ("RSqMC").
Details
R-squared (\(R^{2}\)) and adjusted R-squared (\(\bar{R}^{2}\)) are 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 \(R^{2}\) and \(\bar{R}^{2}\), where \(\alpha\) is the significance level.
See also
Other Beta Monte Carlo Functions:
BetaMC(),
DeltaRSqMC(),
DiffBetaMC(),
FSqMC(),
MC(),
MCMI(),
PCorMC(),
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
)
# RSqMC --------------------------------------------------------------------
out <- RSqMC(object = mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(x = out)
#> Call:
#> RSqMC(object = mc, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0589 100 0.6534 0.8809
#> adj 0.7906 0.0631 100 0.6286 0.8724
summary(object = out)
#> Call:
#> RSqMC(object = mc, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0589 100 0.6534 0.8809
#> adj 0.7906 0.0631 100 0.6286 0.8724
coef(object = out)
#> rsq adj
#> 0.8045263 0.7905638
vcov(object = out)
#> rsq adj
#> rsq 0.003463417 0.003710804
#> adj 0.003710804 0.003975862
confint(object = out, level = 0.95)
#> 2.5 % 97.5 %
#> rsq 0.6533782 0.8809066
#> adj 0.6286195 0.8724000