minorbsem
minorbsem: An R package for structural equation models that account for the influence of minor factors - Published in JOSS (2023)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
bayesian-statistics
factor-analysis
latent-variable-models
multivariate-analysis
psychometrics
r-package
structural-equation-modeling
Last synced: 6 months ago
·
JSON representation
Repository
An R package for Bayesian structural equation models that account for the influence of minor factors
Basic Info
- Host: GitHub
- Owner: jamesuanhoro
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://jamesuanhoro.github.io/minorbsem/
- Size: 8.87 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
- Releases: 1
Topics
bayesian-statistics
factor-analysis
latent-variable-models
multivariate-analysis
psychometrics
r-package
structural-equation-modeling
Created about 3 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
bibliography: inst/REFERENCES.bib
---
# minorbsem
```{r include=FALSE}
# devtools::load_all()
```
[](https://www.repostatus.org/#active)

[](https://app.codecov.io/gh/jamesuanhoro/minorbsem?branch=master)
[`-6666ff.svg)](https://cran.r-project.org/)

[](https://cran.r-project.org/package=minorbsem)

[](https://github.com/jamesuanhoro/minorbsem/actions/workflows/R-CMD-check.yaml)
[](https://joss.theoj.org/papers/c0cd5b1a2d66bbf21fb00d237f646180)
#### Table of Contents
- [Package overview](#package-overview)
- [Goals](#goals)
- [Permitted models and supported data types](#permitted-models-and-supported-data-types)
- [Installation](#installation)
- [A reasonably complete demonstration](#a-reasonably-complete-demonstration)
- [Additional examples](#additional-examples)
- [Different methods to capture the influence of minor factors](#different-methods-to-capture-the-influence-of-minor-factors)
- [Relax simple structure](#relax-simple-structure)
- [Contributions are encouraged](#contributions-are-encouraged)
- [Citations](#citations)
## Package overview
Structural equation models (SEMs) rarely reject the null hypothesis that there is
no model misspecification. One explanation for this problem is that covariance
structures are influenced by major factors which
we can hypothesize about and minor factors which we cannot predict a-priori,
e.g. @maccallum_representing_1991.
### Goals
The goal of `minorbsem` is to facilitate fitting Bayesian SEMs that estimate the
influence of minor factors on the covariance matrix, following the approach in
@uanhoro_modeling_2023. Briefly, the method estimates all residual covariances with
priors that shrink them towards zero, and the model returns the magnitude of the
influence of minor factors.
The package also allows you set priors on all substantive model parameters
directly. Importantly, prior distributions assume latent variables have a
total variance of 1, even in latent regression models.
### Permitted models and supported data types
The package is able to fit a variety of model configurations:
- CFA, allowing automatically estimated penalized cross-loadings
- Path models with latent and observed variables
- Any observed variables in a structural model must be represented with a
single-indicator latent variable with the error variance of the observed
variable constrained to 0
The package is also able to **analyze correlation structures** using methods in
@archakov_new_2021. This includes polychoric correlation matrices as long as
an asymptotic variance matrix is provided. The relevant paper is under review
at Structural Equation Modeling.
The package does not support fitting multi-group or multilevel models.
See the [bayesianmasem](https://github.com/jamesuanhoro/bayesianmasem) package
for multi-group factor analysis via meta-analysis methods.
## Installation
`minorbsem` is hosted on GitHub, so we need the `remotes` package to
install it. We also need to install the `cmdstanr` package and CmdStan
in order to use Stan.
Instructions:
``` r
install.packages("remotes") # install remotes
# next install cmdstanr and CmdStan:
install.packages(
"cmdstanr",
repos = c("https://mc-stan.org/r-packages/", getOption("repos"))
)
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan()
# Then finally minorbsem:
remotes::install_github("jamesuanhoro/minorbsem")
```
## A reasonably complete demonstration
``` r
library(minorbsem)
# Basic Holzinger-Swineford model
syntax_1 <- "
F1 =~ x1 + x2 + x3
F2 =~ x4 + x5 + x6
F3 =~ x7 + x8 + x9"
# Expect a summary table output
fit_1 <- minorbsem(syntax_1, HS)
# Save output table to html file, see: ?pretty_print_summary for more options
pretty_print_summary(fit_1, save_html = "baseline_model.html")
# Histogram of parameters, see: ?parameter_hist for arguments
parameter_hist(fit_1)
# Traceplot of parameters, see: ?parameter_trace for arguments
parameter_trace(fit_1)
# Examine all standardized residual covariances
plot_residuals(fit_1)
plot_residuals(fit_1, type = "range")
```
## Additional examples
### Different methods to capture the influence of minor factors
Default method above is `method = "normal"` assuming standardized residual
covariances are on average 0 and vary from 0 in continuous fashion.
``` r
# Fit same model as above but use global-local prior to estimate
# minor factor influences
fit_gdp <- minorbsem(syntax_1, HS, method = "GDP")
plot_residuals(fit_gdp)
parameter_hist(fit_gdp)
parameter_trace(fit_gdp)
# Ignoring minor factor influences
fit_none <- minorbsem(syntax_1, HS, method = "none")
parameter_hist(fit_none)
parameter_trace(fit_none)
# Error!!!: Plotting residuals will give an error message
# since minor factor influences are assumed null
plot_residuals(fit_none)
```
### Relax simple structure
```r
fit_complex <- minorbsem(syntax_1, HS, simple_struc = FALSE)
```
There are other methods, see details section in `?minorbsem`.
## Contributions are encouraged
All users of R (or SEM) are invited to submit functions or ideas for functions.
Feel free to:
- [open an issue](https://github.com/jamesuanhoro/minorbsem/issues/) to report a
bug or to discuss recommendations;
- submit pull requests to recommend modifications or suggest improvements.
You can also email the package maintainer, James Uanhoro (James dot Uanhoro at unt dot edu).
Thank you for helping improve minorbsem :).
## Citations
Owner
- Name: James Uanhoro
- Login: jamesuanhoro
- Kind: user
- Website: https://www.jamesuanhoro.com/
- Repositories: 1
- Profile: https://github.com/jamesuanhoro
JOSS Publication
minorbsem: An R package for structural equation models that account for the influence of minor factors
Published
June 21, 2023
Volume 8, Issue 86, Page 5292
Tags
Bayesian-statistics latent-variable-models structural-equation-modeling psychometrics meta-analytic-SEMGitHub Events
Total
- Push event: 14
- Pull request event: 6
Last Year
- Push event: 14
- Pull request event: 6
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| jamesuanhoro | j****o@g****m | 217 |
| James Uanhoro | j****s@p****n | 114 |
| Mason Garrison | g****m@w****u | 4 |
| Aaron Peikert | a****t@p****e | 3 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 98
- Average time to close issues: about 1 month
- Average time to close pull requests: about 8 hours
- Total issue authors: 3
- Total pull request authors: 4
- Average comments per issue: 0.2
- Average comments per pull request: 0.11
- Merged pull requests: 96
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stonegold546 (3)
- aaronpeikert (1)
Pull Request Authors
- jamesuanhoro (76)
- stonegold546 (22)
- aaronpeikert (2)
- smasongarrison (1)
Top Labels
Issue Labels
enhancement (2)
long-running (1)
Pull Request Labels
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 3.4.0 depends
- Rcpp >= 0.12.0 imports
- RcppParallel >= 5.0.1 imports
- Rdpack * imports
- ggplot2 * imports
- huxtable * imports
- lavaan * imports
- methods * imports
- posterior * imports
- rstan >= 2.21.8 imports
- rstantools >= 2.3.0 imports
- cmdstanr * suggests
- covr * suggests
- loo * suggests
- testthat >= 3.0.0 suggests
