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.1321 5000 -0.1503 0.3684
#> NARTIC-PCTSUPP 0.2319 0.1239 5000 -0.0038 0.4770
#> PCTGRT-PCTSUPP 0.1282 0.1262 5000 -0.1157 0.3759
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.1321 5000 -0.1589 0.3576
#> NARTIC-PCTSUPP 0.2319 0.1239 5000 -0.0136 0.4729
#> PCTGRT-PCTSUPP 0.1282 0.1262 5000 -0.1127 0.3776
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.1321 5000 -0.1601 0.3567
#> NARTIC-PCTSUPP 0.2319 0.1239 5000 -0.0187 0.4713
#> PCTGRT-PCTSUPP 0.1282 0.1262 5000 -0.1028 0.3890
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.017442261 0.008432058 -0.009010203
#> NARTIC-PCTSUPP 0.008432058 0.015340284 0.006908226
#> PCTGRT-PCTSUPP -0.009010203 0.006908226 0.015918429
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.150288282 0.3684040
#> NARTIC-PCTSUPP -0.003762149 0.4769934
#> PCTGRT-PCTSUPP -0.115720525 0.3759245
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.15893983 0.3575805
#> NARTIC-PCTSUPP -0.01357186 0.4728913
#> PCTGRT-PCTSUPP -0.11269641 0.3776449
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.16007049 0.3567105
#> NARTIC-PCTSUPP -0.01871218 0.4713162
#> PCTGRT-PCTSUPP -0.10282595 0.3889806