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.1283 5000 -0.1477 0.3617
#> NARTIC-PCTSUPP 0.2319 0.1232 5000 -0.0070 0.4809
#> PCTGRT-PCTSUPP 0.1282 0.1260 5000 -0.1139 0.3820Bias 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.1283 5000 -0.1491 0.3595
#> NARTIC-PCTSUPP 0.2319 0.1232 5000 -0.0013 0.4872
#> PCTGRT-PCTSUPP 0.1282 0.1260 5000 -0.1085 0.3864Bias 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.1283 5000 -0.1496 0.3592
#> NARTIC-PCTSUPP 0.2319 0.1232 5000 -0.0031 0.4833
#> PCTGRT-PCTSUPP 0.1282 0.1260 5000 -0.0979 0.3988coef
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.016473348 0.007892655 -0.008580693
#> NARTIC-PCTSUPP 0.007892655 0.015188407 0.007295752
#> PCTGRT-PCTSUPP -0.008580693 0.007295752 0.015876445confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.147696984 0.3617490
#> NARTIC-PCTSUPP -0.007041335 0.4808613
#> PCTGRT-PCTSUPP -0.113930164 0.3819760Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.149050061 0.3595048
#> NARTIC-PCTSUPP -0.001347173 0.4872252
#> PCTGRT-PCTSUPP -0.108473093 0.3864136Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.149580229 0.3592246
#> NARTIC-PCTSUPP -0.003110557 0.4832822
#> PCTGRT-PCTSUPP -0.097925521 0.3988392