betaSandwich: Example Using the RSqSandwich Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-r-sq-sandwich.Rmd
example-r-sq-sandwich.RmdConfidence intervals for multiple correlation are generated using the
RSqSandwich() 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 <- RSqSandwich(std_mvn, alpha = 0.05)
adf <- RSqSandwich(std_adf, alpha = 0.05)
hc3 <- RSqSandwich(std_hc3, alpha = 0.05)Methods
summary
Summary of the results of RSqSandwich().
summary(mvn)
#> Call:
#> RSqSandwich(object = std_mvn, alpha = 0.05)
#>
#> R-squared and adjusted R-squared with MVN standard errors:
#> est se z p 2.5% 97.5%
#> rsq 0.8045 0.0517 15.5608 0 0.7032 0.9059
#> adj 0.7906 0.0554 14.2713 0 0.6820 0.8991
summary(adf)
#> Call:
#> RSqSandwich(object = std_adf, alpha = 0.05)
#>
#> R-squared and adjusted R-squared with MVN standard errors:
#> est se z p 2.5% 97.5%
#> rsq 0.8045 0.0519 15.4910 0 0.7027 0.9063
#> adj 0.7906 0.0556 14.2073 0 0.6815 0.8996
summary(hc3)
#> Call:
#> RSqSandwich(object = std_hc3, alpha = 0.05)
#>
#> R-squared and adjusted R-squared with HC3 standard errors:
#> est se z p 2.5% 97.5%
#> rsq 0.8045 0.0573 14.0286 0 0.6921 0.9169
#> adj 0.7906 0.0614 12.8662 0 0.6701 0.9110References
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