Confidence 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.

library(betaSandwich)
df <- betaSandwich::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 <- 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)
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 4.1345 0.1946 42 0.8467 -7.5393 9.1483
#> adj 0.7906 4.4299 0.1785 42 0.8592 -8.1492 9.7304
#> 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 3.6172 0.2224 42 0.8251 -6.4953 8.1044
#> adj 0.7906 3.8756 0.2040 42 0.8394 -7.0307 8.6118
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 3.9483 0.2038 42 0.8395 -7.1635 8.7725
#> adj 0.7906 4.2303 0.1869 42 0.8527 -7.7466 9.3277

### coef

coef(mvn)
#> 0.8045263 0.7905638
#> 0.8045263 0.7905638
coef(hc3)
#> 0.8045263 0.7905638

### vcov

Calculate the sampling covariance matrix of R-squared and adjusted R-squared.

vcov(mvn)
#> rsq 17.09432 18.31534
#> rsq 13.08433 14.01893
vcov(hc3)
#> rsq 15.58911 16.70262
#> adj 16.70262 17.89567

### confint

Generate confidence intervals for R-squared and adjusted R-squared.

confint(mvn, level = 0.95)
#>         2.5 %   97.5 %
#> rsq -7.539288 9.148341
#> adj -7.746582 9.327709