Ivan Jacob Agaloos Pesigan 2024-06-23
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, 2023: 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.
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("remotes")) install.packages("remotes")
remotes::install_github("jeksterslab/betaMC")
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.
library(betaMC)
df <- betaMC::nas1982
Fit the regression model using the lm()
function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)
mvn <- MC(object, type = "mvn")
adf <- MC(object, type = "adf")
hc3 <- MC(object, type = "hc3")
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.0760 20000 0.3377 0.6364
#> PCTGRT 0.3915 0.0771 20000 0.2386 0.5395
#> PCTSUPP 0.2632 0.0745 20000 0.1163 0.4101
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.0675 20000 0.3515 0.6160
#> PCTGRT 0.3915 0.0708 20000 0.2417 0.5225
#> PCTSUPP 0.2632 0.0765 20000 0.1043 0.4065
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.0796 20000 0.3243 0.6343
#> PCTGRT 0.3915 0.0829 20000 0.2188 0.5437
#> PCTSUPP 0.2632 0.0862 20000 0.0885 0.4244
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.
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.0623 20000 0.6444 0.888
#> adj 0.7906 0.0668 20000 0.6190 0.880
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.0690 20000 0.0483 0.3196
#> PCTGRT 0.1177 0.0554 20000 0.0253 0.2397
#> PCTSUPP 0.0569 0.0377 20000 0.0060 0.1495
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.0870 20000 0.2198 0.5653
#> PCTGRT 0.3430 0.0842 20000 0.1591 0.4896
#> PCTSUPP 0.2385 0.0789 20000 0.0775 0.3867
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.1200 20000 0.1761 0.6506
#> PCTGRT 0.3757 0.1161 20000 0.1024 0.5545
#> PCTSUPP 0.2254 0.1141 20000 0.0248 0.4612
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.1431 20000 -0.1783 0.3790
#> NARTIC-PCTSUPP 0.2319 0.1329 20000 -0.0373 0.4806
#> PCTGRT-PCTSUPP 0.1282 0.1384 20000 -0.1489 0.3929
See GitHub Pages for package documentation.
To cite betaMC
in publications, please cite Pesigan & Cheung (2023).
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., & Cheung, S. F. (2023). Monte Carlo confidence intervals for the indirect effect with missing data. Behavior Research Methods, 56(3), 1678–1696. https://doi.org/10.3758/s13428-023-02114-4