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.0589 5000 0.0815 0.3108
#> PCTGRT  0.1177 0.0496 5000 0.0351 0.2305
#> PCTSUPP 0.0569 0.0347 5000 0.0080 0.1413

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.0589 5000 0.0910 0.3330
#> PCTGRT  0.1177 0.0496 5000 0.0433 0.2449
#> PCTSUPP 0.0569 0.0347 5000 0.0100 0.1474

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.0589 5000 0.0944 0.3416
#> PCTGRT  0.1177 0.0496 5000 0.0477 0.2543
#> PCTSUPP 0.0569 0.0347 5000 0.0085 0.1421

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.0034720896 -0.0002869705 -0.0002661089
#> PCTGRT  -0.0002869705  0.0024601037 -0.0002666999
#> PCTSUPP -0.0002661089 -0.0002666999  0.0012020716

confint

Return confidence intervals.

Percentile Confidence Intervals

confint(out, level = 0.95, type = "pc")
#>               2.5 %    97.5 %
#> NARTIC  0.081465535 0.3108349
#> PCTGRT  0.035073179 0.2304610
#> PCTSUPP 0.007950606 0.1412657

Bias Corrected Confidence Intervals

confint(out, level = 0.95, type = "bc")
#>               2.5 %    97.5 %
#> NARTIC  0.090988626 0.3330395
#> PCTGRT  0.043331663 0.2448889
#> PCTSUPP 0.009966198 0.1473986

Bias Corrected and Accelerated Confidence Intervals

confint(out, level = 0.95, type = "bca")
#>              2.5 %    97.5 %
#> NARTIC  0.09436815 0.3415528
#> PCTGRT  0.04765111 0.2543371
#> PCTSUPP 0.00850364 0.1421013

References