Ivan Jacob Agaloos Pesigan 2026-06-13
Description
Generates Monte Carlo confidence intervals for standardized regression coefficients (beta) and other effect sizes, including multiple correlation, semipartial correlations, improvement in R-squared, squared partial correlations, and differences in standardized regression coefficients, for models fitted by lm(). betaMC combines ideas from Monte Carlo confidence intervals for the indirect effect (Pesigan and Cheung, 2024: http://doi.org/10.3758/s13428-023-02114-4) and the sampling covariance matrix of regression coefficients (Dudgeon, 2017: http://doi.org/10.1007/s11336-017-9563-z) to generate confidence intervals effect sizes in regression.
Installation
You can install the CRAN release of betaMC with:
install.packages("betaMC")You can install the development version of betaMC from GitHub with:
if (!require("pak")) install.packages("pak")
pak::pkg_install("jeksterslab/betaMC")Example
In this example, a multiple regression model is fitted using program quality ratings (QUALITY) as the regressand/outcome variable and number of published articles attributed to the program faculty members (NARTIC), percent of faculty members holding research grants (PCTGRT), and percentage of program graduates who received support (PCTSUPP) as regressor/predictor variables using a data set from 1982 ratings of 46 doctoral programs in psychology in the USA (National Research Council, 1982). Confidence intervals for the standardized regression coefficients are generated using the BetaMC() function from the betaMC package.
df <- betaMC::nas1982Regression
Fit the regression model using the lm() function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)Monte Carlo Sampling Distribution of Parameters
Normal-Theory Approach
mvn <- MC(object, type = "mvn")Asymptotic distribution-free Approach
adf <- MC(object, type = "adf")Heteroskedasticity Consistent Approach (HC3)
hc3 <- MC(object, type = "hc3")Standardized Regression Slopes
Normal-Theory Approach
BetaMC(mvn, alpha = 0.05)
#> Call:
#> BetaMC(object = mvn, alpha = 0.05)
#>
#> Standardized regression slopes
#> type = "mvn"
#> est se R 2.5% 97.5%
#> NARTIC 0.4951 0.0757 20000 0.3386 0.6326
#> PCTGRT 0.3915 0.0766 20000 0.2355 0.5362
#> PCTSUPP 0.2632 0.0748 20000 0.1179 0.4085Asymptotic distribution-free Approach
BetaMC(adf, alpha = 0.05)
#> Call:
#> BetaMC(object = adf, alpha = 0.05)
#>
#> Standardized regression slopes
#> type = "adf"
#> est se R 2.5% 97.5%
#> NARTIC 0.4951 0.0673 20000 0.3538 0.6153
#> PCTGRT 0.3915 0.0705 20000 0.2468 0.5211
#> PCTSUPP 0.2632 0.0763 20000 0.1065 0.4058Heteroskedasticity Consistent Approach (HC3)
BetaMC(hc3, alpha = 0.05)
#> Call:
#> BetaMC(object = hc3, alpha = 0.05)
#>
#> Standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4951 0.0800 20000 0.3250 0.6373
#> PCTGRT 0.3915 0.0815 20000 0.2165 0.5388
#> PCTSUPP 0.2632 0.0853 20000 0.0887 0.4259Other Effect Sizes
The betaMC package also has functions to generate Monte Carlo confidence intervals for other effect sizes such as RSqMC() for multiple correlation coefficients (R-squared and adjusted R-squared), DeltaRSqMC() for improvement in R-squared, SCorMC() for semipartial correlation coefficients, PCorMC() for squared partial correlation coefficients, and DiffBetaMC() for differences of standardized regression coefficients.
Multiple Correlation Coefficients (R-squared and adjusted R-squared)
RSqMC(hc3, alpha = 0.05)
#> Call:
#> RSqMC(object = hc3, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0620 20000 0.6470 0.8886
#> adj 0.7906 0.0664 20000 0.6218 0.8806Improvement in R-squared
DeltaRSqMC(hc3, alpha = 0.05)
#> Call:
#> DeltaRSqMC(object = hc3, alpha = 0.05)
#>
#> Improvement in R-squared
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.1859 0.0691 20000 0.0511 0.3217
#> PCTGRT 0.1177 0.0538 20000 0.0250 0.2350
#> PCTSUPP 0.0569 0.0373 20000 0.0061 0.1486Semipartial Correlation Coefficients
SCorMC(hc3, alpha = 0.05)
#> Call:
#> SCorMC(object = hc3, alpha = 0.05)
#>
#> Semipartial correlations
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0867 20000 0.2260 0.5672
#> PCTGRT 0.3430 0.0822 20000 0.1582 0.4848
#> PCTSUPP 0.2385 0.0781 20000 0.0782 0.3855Squared Partial Correlation Coefficients
PCorMC(hc3, alpha = 0.05)
#> Call:
#> PCorMC(object = hc3, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.1191 20000 0.1807 0.6518
#> PCTGRT 0.3757 0.1150 20000 0.1046 0.5534
#> PCTSUPP 0.2254 0.1126 20000 0.0252 0.4523Differences of Standardized Regression Coefficients
DiffBetaMC(hc3, alpha = 0.05)
#> Call:
#> DiffBetaMC(object = hc3, alpha = 0.05)
#>
#> Differences of standardized regression slopes
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC-PCTGRT 0.1037 0.1422 20000 -0.1732 0.3831
#> NARTIC-PCTSUPP 0.2319 0.1336 20000 -0.0397 0.4863
#> PCTGRT-PCTSUPP 0.1282 0.1357 20000 -0.1440 0.3910Documentation
See GitHub Pages for package documentation.