betaSandwich: Example Using the RSqBetaSandwich Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-r-sq-beta-sandwich.Rmd
example-r-sq-beta-sandwich.RmdConfidence intervals for multiple correlation are generated using the
RSqBetaSandwich() function from the
betaSandwich package. In this example, we use the data set
and the model used in betaSandwich:
Example Using the BetaHC Function.
df <- betaSandwich::nas1982Fit 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 <- BetaN(object)Asymptotic Distribution-Free Approach
std_adf <- BetaADF(object)HC3
std_hc3 <- BetaHC(object, type = "hc3")Estimate the multiple correlation coefficients (R-squared and adjusted R-squared) and the corresponding sampling covariance matrix.
mvn <- RSqBetaSandwich(std_mvn, alpha = 0.05)
adf <- RSqBetaSandwich(std_adf, alpha = 0.05)
hc3 <- RSqBetaSandwich(std_hc3, alpha = 0.05)Methods
summary
Summary of the results of RSqBetaSandwich().
summary(mvn)
#> Call:
#> RSqBetaSandwich(object = std_mvn, alpha = 0.05)
#>
#> Multiple correlation with MVN standard errors:
#> est se t df p 2.5% 97.5%
#> rsq 0.8045 0.0328 24.5344 42 0 0.7383 0.8707
#> adj 0.7906 0.0351 22.5014 42 0 0.7197 0.8615
summary(adf)
#> Call:
#> RSqBetaSandwich(object = std_adf, alpha = 0.05)
#>
#> Multiple correlation with MVN standard errors:
#> est se t df p 2.5% 97.5%
#> rsq 0.8045 0.0287 28.0431 42 0 0.7466 0.8624
#> adj 0.7906 0.0307 25.7193 42 0 0.7285 0.8526
summary(hc3)
#> Call:
#> RSqBetaSandwich(object = std_hc3, alpha = 0.05)
#>
#> Multiple correlation with HC3 standard errors:
#> est se t df p 2.5% 97.5%
#> rsq 0.8045 0.0313 25.6916 42 0 0.7413 0.8677
#> adj 0.7906 0.0336 23.5627 42 0 0.7229 0.8583References
Dudgeon, P. (2017). Some improvements in confidence intervals for
standardized regression coefficients. Psychometrika,
82(4), 928–951. https://doi.org/10.1007/s11336-017-9563-z
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