betaNB: Example Using the DiffBetaNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-diff-beta-nb.Rmd
example-diff-beta-nb.RmdConfidence 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::nas1982Regression
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.1329 5000 -0.1505 0.3772
#> NARTIC-PCTSUPP 0.2319 0.1225 5000 -0.0057 0.4740
#> PCTGRT-PCTSUPP 0.1282 0.1292 5000 -0.1202 0.3851Bias 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.1329 5000 -0.1534 0.3721
#> NARTIC-PCTSUPP 0.2319 0.1225 5000 -0.0080 0.4724
#> PCTGRT-PCTSUPP 0.1282 0.1292 5000 -0.1185 0.3866Bias 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.1329 5000 -0.1542 0.3703
#> NARTIC-PCTSUPP 0.2319 0.1225 5000 -0.0111 0.4703
#> PCTGRT-PCTSUPP 0.1282 0.1292 5000 -0.1103 0.4030coef
Return the vector of estimates.
coef(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> 0.1036564 0.2318974 0.1282410vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.017651824 0.007988859 -0.009662965
#> NARTIC-PCTSUPP 0.007988859 0.015016621 0.007027762
#> PCTGRT-PCTSUPP -0.009662965 0.007027762 0.016690727confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.150480661 0.3772345
#> NARTIC-PCTSUPP -0.005705318 0.4740124
#> PCTGRT-PCTSUPP -0.120157233 0.3851081Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.153380642 0.3721251
#> NARTIC-PCTSUPP -0.007956253 0.4723853
#> PCTGRT-PCTSUPP -0.118456359 0.3865906Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.15419709 0.3703264
#> NARTIC-PCTSUPP -0.01111746 0.4703496
#> PCTGRT-PCTSUPP -0.11031963 0.4030103