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")
#> Call:
#> DiffBetaNB(object = nb, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1296 5000 -0.1390 0.3629
#> NARTIC-PCTSUPP 0.2319 0.1219 5000 -0.0070 0.4746
#> PCTGRT-PCTSUPP 0.1282 0.1279 5000 -0.1186 0.3840
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> Call:
#> DiffBetaNB(object = nb, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "bc"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1296 5000 -0.1437 0.3594
#> NARTIC-PCTSUPP 0.2319 0.1219 5000 -0.0103 0.4673
#> PCTGRT-PCTSUPP 0.1282 0.1279 5000 -0.1110 0.3890
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> Call:
#> DiffBetaNB(object = nb, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "bca"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1296 5000 -0.1448 0.3564
#> NARTIC-PCTSUPP 0.2319 0.1219 5000 -0.0124 0.4642
#> PCTGRT-PCTSUPP 0.1282 0.1279 5000 -0.1011 0.4026
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.016796288 0.007643631 -0.009152657
#> NARTIC-PCTSUPP 0.007643631 0.014859415 0.007215785
#> PCTGRT-PCTSUPP -0.009152657 0.007215785 0.016368441
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.139032096 0.3628926
#> NARTIC-PCTSUPP -0.007034197 0.4746073
#> PCTGRT-PCTSUPP -0.118561717 0.3840491
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.14370664 0.3594454
#> NARTIC-PCTSUPP -0.01026321 0.4672611
#> PCTGRT-PCTSUPP -0.11103882 0.3890321
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.1448315 0.3564058
#> NARTIC-PCTSUPP -0.0124456 0.4641806
#> PCTGRT-PCTSUPP -0.1011013 0.4026161