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.0586 5000 0.0838 0.3085
#> PCTGRT  0.1177 0.0492 5000 0.0331 0.2245
#> PCTSUPP 0.0569 0.0331 5000 0.0091 0.1339

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.0586 5000 0.0927 0.3303
#> PCTGRT  0.1177 0.0492 5000 0.0401 0.2377
#> PCTSUPP 0.0569 0.0331 5000 0.0119 0.1435

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.0586 5000 0.0959 0.3412
#> PCTGRT  0.1177 0.0492 5000 0.0442 0.2498
#> PCTSUPP 0.0569 0.0331 5000 0.0108 0.1392

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.0034381256 -0.0002968967 -0.0002042447
#> PCTGRT  -0.0002968967  0.0024191724 -0.0002695659
#> PCTSUPP -0.0002042447 -0.0002695659  0.0010983553

confint

Return confidence intervals.

Percentile Confidence Intervals

confint(out, level = 0.95, type = "pc")
#>               2.5 %    97.5 %
#> NARTIC  0.083837829 0.3085058
#> PCTGRT  0.033137757 0.2245223
#> PCTSUPP 0.009102492 0.1338839

Bias Corrected Confidence Intervals

confint(out, level = 0.95, type = "bc")
#>              2.5 %    97.5 %
#> NARTIC  0.09272085 0.3303035
#> PCTGRT  0.04009656 0.2376580
#> PCTSUPP 0.01190134 0.1434842

Bias Corrected and Accelerated Confidence Intervals

confint(out, level = 0.95, type = "bca")
#>              2.5 %    97.5 %
#> NARTIC  0.09592824 0.3411882
#> PCTGRT  0.04424093 0.2498473
#> PCTSUPP 0.01077390 0.1391943

References