Skip to contents

Confidence intervals for improvement in R-squared are generated using the DeltaRSqNB() function from the betaNB package. In this example, we use the data set and the model used in betaNB: Example Using the BetaNB Function.

df <- betaNB::nas1982

Regression

Fit the regression model using the lm() function.

object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)

Nonparametric Bootstrap

nb <- NB(object)

Improvement in R-squared

Normal-Theory Approach

out <- DeltaRSqNB(nb, alpha = 0.05)

Methods

summary

Summary of the results of DeltaRSqNB().

Percentile Confidence Intervals

summary(out, type = "pc")
#> Call:
#> DeltaRSqNB(object = nb, alpha = 0.05)
#> 
#> Improvement in R-squared
#> type = "pc"
#>            est     se    R   2.5%  97.5%
#> NARTIC  0.1859 0.0575 5000 0.0815 0.3062
#> PCTGRT  0.1177 0.0495 5000 0.0342 0.2289
#> PCTSUPP 0.0569 0.0347 5000 0.0086 0.1396

Bias Corrected Confidence Intervals

summary(out, type = "bc")
#> Call:
#> DeltaRSqNB(object = nb, alpha = 0.05)
#> 
#> Improvement in R-squared
#> type = "bc"
#>            est     se    R   2.5%  97.5%
#> NARTIC  0.1859 0.0575 5000 0.0951 0.3282
#> PCTGRT  0.1177 0.0495 5000 0.0440 0.2513
#> PCTSUPP 0.0569 0.0347 5000 0.0113 0.1515

Bias Corrected and Accelerated Confidence Intervals

summary(out, type = "bca")
#> Call:
#> DeltaRSqNB(object = nb, alpha = 0.05)
#> 
#> Improvement in R-squared
#> type = "bca"
#>            est     se    R   2.5%  97.5%
#> NARTIC  0.1859 0.0575 5000 0.0985 0.3355
#> PCTGRT  0.1177 0.0495 5000 0.0481 0.2643
#> PCTSUPP 0.0569 0.0347 5000 0.0099 0.1446

coef

Return the vector of estimates.

coef(out)
#>    NARTIC    PCTGRT   PCTSUPP 
#> 0.1858925 0.1176542 0.0568722

vcov

Return the sampling covariance matrix.

vcov(out)
#>                NARTIC        PCTGRT       PCTSUPP
#> NARTIC   0.0033113309 -0.0002594042 -0.0002189179
#> PCTGRT  -0.0002594042  0.0024457004 -0.0002534862
#> PCTSUPP -0.0002189179 -0.0002534862  0.0012009647

confint

Return confidence intervals.

Percentile Confidence Intervals

confint(out, level = 0.95, type = "pc")
#>               2.5 %    97.5 %
#> NARTIC  0.081522422 0.3062433
#> PCTGRT  0.034212070 0.2288758
#> PCTSUPP 0.008608398 0.1395945

Bias Corrected Confidence Intervals

confint(out, level = 0.95, type = "bc")
#>              2.5 %    97.5 %
#> NARTIC  0.09510329 0.3281771
#> PCTGRT  0.04401735 0.2513203
#> PCTSUPP 0.01127660 0.1514531

Bias Corrected and Accelerated Confidence Intervals

confint(out, level = 0.95, type = "bca")
#>               2.5 %    97.5 %
#> NARTIC  0.098526907 0.3354594
#> PCTGRT  0.048066005 0.2643457
#> PCTSUPP 0.009911024 0.1445617

References