betaNB: Example Using the DiffBetaNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-diff-beta-nb.Rmd
example-diff-beta-nb.Rmd
Confidence intervals for differences of standardized regression
slopes are generated using the DiffBetaNB()
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)
Differences of Standardized Regression Slopes
Normal-Theory Approach
out <- DiffBetaNB(nb, alpha = 0.05)
Methods
summary
Summary of the results of DiffBetaNB()
.
Percentile Confidence Intervals
summary(out, type = "pc")
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1327 5000 -0.1592 0.3678
#> NARTIC-PCTSUPP 0.2319 0.1236 5000 0.0005 0.4838
#> PCTGRT-PCTSUPP 0.1282 0.1293 5000 -0.1193 0.3929
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1327 5000 -0.1616 0.3661
#> NARTIC-PCTSUPP 0.2319 0.1236 5000 -0.0081 0.4747
#> PCTGRT-PCTSUPP 0.1282 0.1293 5000 -0.1189 0.3949
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1327 5000 -0.1623 0.3645
#> NARTIC-PCTSUPP 0.2319 0.1236 5000 -0.0113 0.4714
#> PCTGRT-PCTSUPP 0.1282 0.1293 5000 -0.1098 0.4069
coef
Return the vector of estimates.
coef(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> 0.1036564 0.2318974 0.1282410
vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.01761123 0.008094890 -0.009516340
#> NARTIC-PCTSUPP 0.00809489 0.015284462 0.007189571
#> PCTGRT-PCTSUPP -0.00951634 0.007189571 0.016705911
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.1592281489 0.3678451
#> NARTIC-PCTSUPP 0.0005264108 0.4837941
#> PCTGRT-PCTSUPP -0.1193193838 0.3928567
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.16162391 0.3661171
#> NARTIC-PCTSUPP -0.00805209 0.4747354
#> PCTGRT-PCTSUPP -0.11890965 0.3949405
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.16233881 0.3644755
#> NARTIC-PCTSUPP -0.01127228 0.4714225
#> PCTGRT-PCTSUPP -0.10979509 0.4068959