Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeksterslab/betamc
betaMC: Generates Monte Carlo confidence intervals for standardized regression coefficients for models fitted by lm().
https://github.com/jeksterslab/betamc
confidence-intervals monte-carlo r r-package regression-effect-sizes standardized-regression-coefficients
Last synced: 15 days ago
JSON representation
betaMC: Generates Monte Carlo confidence intervals for standardized regression coefficients for models fitted by lm().
- Host: GitHub
- URL: https://github.com/jeksterslab/betamc
- Owner: jeksterslab
- License: other
- Created: 2022-12-23T14:51:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-09T03:58:28.000Z (7 months ago)
- Last Synced: 2024-04-09T04:31:01.743Z (7 months ago)
- Topics: confidence-intervals, monte-carlo, r, r-package, regression-effect-sizes, standardized-regression-coefficients
- Language: TeX
- Homepage: https://jeksterslab.github.io/betaMC/
- Size: 17.7 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
betaMC
================
Ivan Jacob Agaloos Pesigan
2024-10-22[![CRAN
Status](https://www.r-pkg.org/badges/version/betaMC)](https://cran.r-project.org/package=betaMC)
[![R-Universe
Status](https://jeksterslab.r-universe.dev/badges/betaMC)](https://jeksterslab.r-universe.dev/betaMC)
[![DOI](https://zenodo.org/badge/DOI/10.3758/s13428-023-02114-4.svg)](https://doi.org/10.3758/s13428-023-02114-4)
[![Make
Project](https://github.com/jeksterslab/betaMC/actions/workflows/make.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/make.yml)
[![R-CMD-check](https://github.com/jeksterslab/betaMC/actions/workflows/check-full.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/check-full.yml)
[![R Package Test
Coverage](https://github.com/jeksterslab/betaMC/actions/workflows/test-coverage.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/test-coverage.yml)
[![Lint R
Package](https://github.com/jeksterslab/betaMC/actions/workflows/lint.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/lint.yml)
[![Package Website (GitHub
Pages)](https://github.com/jeksterslab/betaMC/actions/workflows/pkgdown-gh-pages.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/pkgdown-gh-pages.yml)
[![Compile
LaTeX](https://github.com/jeksterslab/betaMC/actions/workflows/latex.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/latex.yml)
[![Shell
Check](https://github.com/jeksterslab/betaMC/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/shellcheck.yml)
[![pages-build-deployment](https://github.com/jeksterslab/betaMC/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/jeksterslab/betaMC/actions/workflows/pages/pages-build-deployment)
[![codecov](https://codecov.io/gh/jeksterslab/betaMC/branch/main/graph/badge.svg?token=KVLUET3DJ6)](https://codecov.io/gh/jeksterslab/betaMC)## 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, 2023: ) and the
sampling covariance matrix of regression coefficients (Dudgeon, 2017:
) to generate confidence
intervals effect sizes in regression.## Installation
You can install the CRAN release of `betaMC` with:
``` r
install.packages("betaMC")
```You can install the development version of `betaMC` from
[GitHub](https://github.com/jeksterslab/betaMC) with:``` r
if (!require("remotes")) install.packages("remotes")
remotes::install_github("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.``` r
library(betaMC)
`````` r
df <- betaMC::nas1982
```### Regression
Fit the regression model using the `lm()` function.
``` r
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)
```### Monte Carlo Sampling Distribution of Parameters
#### Normal-Theory Approach
``` r
mvn <- MC(object, type = "mvn")
```#### Asymptotic distribution-free Approach
``` r
adf <- MC(object, type = "adf")
```#### Heteroskedasticity Consistent Approach (HC3)
``` r
hc3 <- MC(object, type = "hc3")
```### Standardized Regression Slopes
#### Normal-Theory Approach
``` r
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.0758 20000 0.3402 0.6361
#> PCTGRT 0.3915 0.0767 20000 0.2368 0.5383
#> PCTSUPP 0.2632 0.0746 20000 0.1177 0.4094
```#### Asymptotic distribution-free Approach
``` r
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.0679 20000 0.3513 0.6170
#> PCTGRT 0.3915 0.0712 20000 0.2418 0.5228
#> PCTSUPP 0.2632 0.0769 20000 0.1071 0.4090
```#### Heteroskedasticity Consistent Approach (HC3)
``` r
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.3227 0.6348
#> PCTGRT 0.3915 0.0826 20000 0.2192 0.5439
#> PCTSUPP 0.2632 0.0862 20000 0.0867 0.4267
```### Other 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)
``` r
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.0622 20000 0.6430 0.8876
#> adj 0.7906 0.0667 20000 0.6175 0.8796
```#### Improvement in R-squared
``` r
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.0498 0.3231
#> PCTGRT 0.1177 0.0549 20000 0.0250 0.2392
#> PCTSUPP 0.0569 0.0378 20000 0.0056 0.1514
```#### Semipartial Correlation Coefficients
``` r
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.0871 20000 0.2231 0.5684
#> PCTGRT 0.3430 0.0834 20000 0.1581 0.4890
#> PCTSUPP 0.2385 0.0788 20000 0.0751 0.3891
```#### Squared Partial Correlation Coefficients
``` r
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.1197 20000 0.1754 0.6491
#> PCTGRT 0.3757 0.1154 20000 0.1058 0.5558
#> PCTSUPP 0.2254 0.1134 20000 0.0234 0.4611
```#### Differences of Standardized Regression Coefficients
``` r
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.1428 20000 -0.1856 0.3771
#> NARTIC-PCTSUPP 0.2319 0.1336 20000 -0.0382 0.4868
#> PCTGRT-PCTSUPP 0.1282 0.1383 20000 -0.1483 0.3938
```## Documentation
See [GitHub Pages](https://jeksterslab.github.io/betaMC/index.html) for
package documentation.## Citation
To cite `betaMC` in publications, please cite Pesigan & Cheung (2023).
## References
Dudgeon, P. (2017). Some improvements in confidence intervals for
standardized regression coefficients. *Psychometrika*, *82*(4), 928–951.National Research Council. (1982). *An assessment of research-doctorate
programs in the United States: Social and behavioral sciences*. National
Academies Press.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.