Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping
Source:R/betaNB-delta-r-sq-nb.R
DeltaRSqNB.Rd
Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping
Usage
DeltaRSqNB(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 \(\Delta R^{2}\).
- vcov
Sampling variance-covariance matrix of \(\Delta R^{2}\).
- est
Vector of estimated \(\Delta R^{2}\).
- fun
Function used ("DeltaRSqNB").
Details
The vector of improvement in R-squared (\(\Delta 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 \(\Delta R^{2}\), where \(\alpha\) is the significance level.
Examples
# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")
# Fit Model in lm ----------------------------------------------------------
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982)
# NB -----------------------------------------------------------------------
nb <- NB(
object,
R = 100, # use a large value e.g., 5000L for actual research
seed = 0508
)
# DeltaRSqNB ---------------------------------------------------------------
out <- DeltaRSqNB(nb, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(out)
#> Call:
#> DeltaRSqNB(object = nb, alpha = 0.05)
#>
#> Improvement in R-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC 0.1859 0.0543 100 0.0797 0.2945
#> PCTGRT 0.1177 0.0507 100 0.0374 0.2216
#> PCTSUPP 0.0569 0.0342 100 0.0091 0.1396
summary(out)
#> Call:
#> DeltaRSqNB(object = nb, alpha = 0.05)
#>
#> Improvement in R-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC 0.1859 0.0543 100 0.0797 0.2945
#> PCTGRT 0.1177 0.0507 100 0.0374 0.2216
#> PCTSUPP 0.0569 0.0342 100 0.0091 0.1396
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.1858925 0.1176542 0.0568722
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0029458986 0.0003342570 -0.0004080511
#> PCTGRT 0.0003342570 0.0025659708 -0.0002009029
#> PCTSUPP -0.0004080511 -0.0002009029 0.0011699276
confint(out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.079688018 0.2944650
#> PCTGRT 0.037358975 0.2216272
#> PCTSUPP 0.009079169 0.1395662