Estimate Multiple Correlation Coefficients (R-Squared and Adjusted R-Squared) and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping
Source:R/betaNB-r-sq-nb.R
RSqNB.RdEstimate Multiple Correlation Coefficients (R-Squared and Adjusted R-Squared) and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping
Usage
RSqNB(object, alpha = c(0.05, 0.01, 0.001))Arguments
- object
Object of class
nb, that is, the output of theNB()function.- alpha
Numeric vector. Significance level \(\alpha\).
Value
Returns an object
of class betanb 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 ("RSqNB").
Details
R-squared (\(R^{2}\)) and adjusted R-squared (\(\bar{R}^{2}\)) is estimated from bootstrap samples. 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.
Let \(\boldsymbol{\beta}^{\ast}\) be the vector of standardized slopes,
\(\boldsymbol{R}_{x}\) the correlation matrix of the regressors,
\(r^{jj}\) the \(j\)th diagonal element of \(\boldsymbol{R}_{x}^{-1}\),
and \(R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x}
\boldsymbol{\beta}^{\ast}\).
The R-squared and the adjusted R-squared are
$$R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x}
\boldsymbol{\beta}^{\ast}, \quad \bar{R}^{2} = 1 - \left( 1 - R^{2} \right)
\frac{n - 1}{n - k},$$
where \(n\) is the sample size and \(k\) is the number of parameters
in the regression model, including the intercept.
Each effect size is computed from every bootstrap sample
(see NB()), and the confidence intervals are percentile-based.
See also
Other Beta Nonparametric Bootstrap Functions:
BetaNB(),
DeltaRSqNB(),
DiffBetaNB(),
FSqNB(),
NB(),
PCorNB(),
SCorNB()
Examples
# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")
# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
data = nas1982
)
# NB -----------------------------------------------------------------------
nb <- NB(
object = object,
R = 100, # use a large value e.g., 5000L for actual research
seed = 0508
)
# RSqNB --------------------------------------------------------------------
out <- RSqNB(object = nb, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(x = out)
#> Call:
#> RSqNB(object = nb, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0499 100 0.7110 0.8872
#> adj 0.7906 0.0534 100 0.6903 0.8792
summary(object = out)
#> Call:
#> RSqNB(object = nb, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0499 100 0.7110 0.8872
#> adj 0.7906 0.0534 100 0.6903 0.8792
coef(object = out)
#> rsq adj
#> 0.8045263 0.7905638
vcov(object = out)
#> rsq adj
#> rsq 0.002485577 0.002663118
#> adj 0.002663118 0.002853340
confint(object = out, level = 0.95)
#> 2.5 % 97.5 %
#> rsq 0.7109512 0.8872404
#> adj 0.6903048 0.8791862