betaDelta: Example Using the DiffBetaDelta Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-diff-beta-delta.Rmd
example-diff-beta-delta.Rmd
Confidence intervals for differences of standardized regression
slopes are generated using the DiffBetaDelta()
function
from the betaDelta
package. In this example, we use the
data set and the model used in betaDelta: Example Using the BetaDelta
Function.
df <- betaDelta::nas1982
Fit the regression model using the lm()
function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)
Estimate the standardized regression slopes and the corresponding sampling covariance matrix.
Multivariate Normal-Theory Approach
std_mvn <- BetaDelta(object, type = "mvn")
Asymptotic Distribution-Free Approach
std_adf <- BetaDelta(object, type = "adf")
Estimate differences of standardized regression slopes and the corresponding sampling covariance matrix.
mvn <- DiffBetaDelta(std_mvn, alpha = 0.05)
adf <- DiffBetaDelta(std_adf, alpha = 0.05)
summary
Summary of the results of DiffBetaDelta()
.
summary(mvn)
#> Call:
#> DiffBetaDelta(object = std_mvn, alpha = 0.05)
#>
#> Difference between standardized regression coefficients with MVN standard errors:
#> est se z p 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1357 0.7640 0.4449 -0.1623 0.3696
#> NARTIC-PCTSUPP 0.2319 0.1252 1.8524 0.0640 -0.0135 0.4773
#> PCTGRT-PCTSUPP 0.1282 0.1227 1.0451 0.2960 -0.1123 0.3688
summary(adf)
#> Call:
#> DiffBetaDelta(object = std_adf, alpha = 0.05)
#>
#> Difference between standardized regression coefficients with ADF standard errors:
#> est se z p 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1212 0.8555 0.3923 -0.1338 0.3411
#> NARTIC-PCTSUPP 0.2319 0.1181 1.9642 0.0495 0.0005 0.4633
#> PCTGRT-PCTSUPP 0.1282 0.1215 1.0555 0.2912 -0.1099 0.3664
vcov
Calculate the sampling covariance matrix of differences of standardized regression slopes.
vcov(mvn)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.018408653 0.009511262 -0.008897391
#> NARTIC-PCTSUPP 0.009511262 0.015672035 0.006160773
#> PCTGRT-PCTSUPP -0.008897391 0.006160773 0.015058164
vcov(adf)
#> NARTIC-PCTGRT NARTIC-PCTSUPP PCTGRT-PCTSUPP
#> NARTIC-PCTGRT 0.014681407 0.006928651 -0.007752755
#> NARTIC-PCTSUPP 0.006928651 0.013938955 0.007010303
#> PCTGRT-PCTSUPP -0.007752755 0.007010303 0.014763058
confint
Generate confidence intervals for differences of standardized regression slopes.
confint(mvn, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.16226855 0.3695814
#> NARTIC-PCTSUPP -0.01346652 0.4772614
#> PCTGRT-PCTSUPP -0.11226950 0.3687516
confint(adf, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC-PCTGRT -0.1338262589 0.3411391
#> NARTIC-PCTSUPP 0.0004975295 0.4632974
#> PCTGRT-PCTSUPP -0.1099011119 0.3663832
References
National Research Council. (1982). An assessment of
research-doctorate programs in the United States: Social
and behavioral sciences. National Academies Press. https://doi.org/10.17226/9781
Pesigan, I. J. A., Sun, R. W., & Cheung, S. F. (2023). betaDelta and betaSandwich: Confidence intervals for
standardized regression coefficients in R. Multivariate
Behavioral Research, 58(6), 1183–1186. https://doi.org/10.1080/00273171.2023.2201277