OpenMx

Repository for the OpenMx Structural Equation Modeling package

https://github.com/openmx/openmx

Science Score: 57.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 3 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    13 of 50 committers (26.0%) from academic institutions
  • Institutional organization owner
    Organization openmx has institutional domain (openmx.ssri.psu.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.4%) to scientific vocabulary

Keywords

behavior-genetics c-plus-plus estimation graphical-models growth-curves item-response-theory multilevel-models openmx psychology r statistics structural-equation-modeling

Keywords from Contributors

standardization
Last synced: 6 months ago · JSON representation

Repository

Repository for the OpenMx Structural Equation Modeling package

Basic Info
Statistics
  • Stars: 92
  • Watchers: 12
  • Forks: 36
  • Open Issues: 90
  • Releases: 0
Topics
behavior-genetics c-plus-plus estimation graphical-models growth-curves item-response-theory multilevel-models openmx psychology r statistics structural-equation-modeling
Created almost 14 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing

README.md

OpenMx

Build Status Codecov test coverage cran version Monthly Downloads Total Downloads DOI <!-- badges: end -->

OpenMx is a Structural Equation Modeling package that encourages users to treat model specifications as something to be generated and manipulated programmatically.

TOC

Overview

OpenMx is the next generation of the Mx structural equation modeling tool. It is an R package activelly maintained and supported with the work of developers around the globe. It is designed to allow the user the most freedom possible while specifying structural equation models, therefore providing minimal defaults. This helps the user know that each specification/optimization decision comes with their own assumptions and influences model interpretation.

Installation

The package is on CRAN and should be installed with:

r install.packages("OpenMx")

Development versions

Developers commit to the master branch. Intrepid users are encouraged to install the master branch. In order to install locally clone this repo and run:

r make cran-install # for the CRAN version make install # for the version with the proprietary NPSOL optimizer

The stable branch can be considered our current alpha release.

The stable branch is updated automatically when all models/passing and models/nightly tests pass along with make cran-check.

On macOS, this can be installed as a binary via travis:

```r

install.packages("https://vipbg.vcu.edu/vipbg/OpenMx2/software/bin/macosx/travis/OpenMx_latest.tgz")

```

Documentation

OpenMx can fit everything from confirmatory factor analyses, through multiple group, mixture distribution, categorical threshold, modern test theory, differential equations, state space, and many others. Models may be specified as RAM or LISREL paths, or directly in matrix algebra. Fit functions include ML (summary and full information) and WLS.

The package manual can be accessed online in the link, and as a pdf from the link. The manual includes example models and scripts for the most common cases.

Quick usage examples

Path specifications are matematically complete and is often considered an easier approach to teaching and analysis. The path below represents a simple regression:

path

Simple regression in path specification

One can specify the above model using the following code:

```r require(OpenMx)

data(myRegDataRaw) # load data names(myRegDataRaw) # get names SimpleDataRaw <- myRegDataRaw[,c("x","y")] # take only what is needed

dataRaw <- mxData( observed=SimpleDataRaw, type="raw" )

variance paths

varPaths <- mxPath( from=c("x","y"), arrows=2, free=TRUE, values = c(1,1), labels=c("varx","residual") )

regression weights

regPaths <- mxPath( from="x", to="y", arrows=1, free=TRUE, values=1, labels="beta1" )

means and intercepts

means <- mxPath( from="one", to=c("x","y"), arrows=1, free=TRUE, values=c(1,1), labels=c("meanx","beta0") )

uniRegModel <- mxModel(model="Simple Regression Path Specification", type="RAM", dataRaw, manifestVars=c("x","y"), varPaths, regPaths, means)

uniRegFit <- mxRun(uniRegModel) # run it summary(uniRegFit) ```

And the following output should appear in your R environment:

``` Summary of Simple Regression Path Specification

free parameters: name matrix row col Estimate Std.Error A 1 beta1 A y x 0.48311962 0.07757687 2 varx S x x 1.10531952 0.15631652 3 residual S y y 0.66520320 0.09407411 4 meanx M 1 x 0.05415975 0.10513428 5 beta0 M 1 y 2.54776414 0.08166814

Model Statistics: | Parameters | Degrees of Freedom | Fit (-2lnL units) Model: 5 195 536.8226 Saturated: 5 195 NA Independence: 4 196 NA Number of observations/statistics: 100/200

Information Criteria: | df Penalty | Parameters Penalty | Sample-Size Adjusted AIC: 146.8226 546.8226 547.4609 BIC: -361.1856 559.8484 544.0572 CFI: NA TLI: 1 (also known as NNFI) RMSEA: 0 [95% CI (NA, NA)] Prob(RMSEA <= 0.05): NA To get additional fit indices, see help(mxRefModels) timestamp: 2022-05-01 09:53:24 ```

Simple regression using matrix algebra

Since OpenMx is considered the specialist tool, you are probably more interested in the flexibility provided by the fact that you can build your own formulas. So going back to the simple regression, now in the formula (equivalent to the path specified in previous section):

simple regression

It can be implemented with the following code:

```r require(OpenMx)

data(myRegDataRaw) # load data SimpleDataRaw <- myRegDataRaw[,c("x","y")] # take only what is needed

create a data object

dataRaw <- mxData( observed=SimpleDataRaw, type="raw" )

A matrix

matrA <- mxMatrix( type="Full", nrow=2, ncol=2, free=c(F,F,T,F), values=c(0,0,1,0), labels=c(NA,NA,"beta1",NA), byrow=TRUE, name="A" )

S matrix

matrS <- mxMatrix( type="Symm", nrow=2, ncol=2, free=c(T,F,F,T), values=c(1,0,0,1), labels=c("varx",NA,NA,"residual"), byrow=TRUE, name="S" )

Filter matrix

matrF <- mxMatrix( type="Iden", nrow=2, ncol=2, name="F" )

M matrix

matrM <- mxMatrix( type="Full", nrow=1, ncol=2, free=c(T,T), values=c(0,0), labels=c("meanx","beta0"), name="M")

Which expectation? RAM in this case

expRAM <- mxExpectationRAM("A","S","F","M", dimnames=c("x","y"))

Run a maximum likelihood

funML <- mxFitFunctionML()

Name it, pass the objects on to a final model object

uniRegModel <- mxModel("Simple Regression Matrix Specification", dataRaw, matrA, matrS, matrF, matrM, expRAM, funML)

Run it!

uniRegFit <- mxRun(uniRegModel)

summary(uniRegFit) ```

Now the output looks like:

``` Running Simple Regression Matrix Specification with 5 parameters Summary of Simple Regression Matrix Specification

free parameters: name matrix row col Estimate Std.Error A 1 beta1 A 2 1 0.48311963 0.07757699 2 varx S 1 1 1.10531937 0.15631498 3 residual S 2 2 0.66520312 0.09407369 4 meanx M 1 x 0.05416001 0.10513400 5 beta0 M 1 y 2.54776424 0.08166812

Model Statistics: | Parameters | Degrees of Freedom | Fit (-2 Model: 5 195 Saturated: 5 195 Independence: 4 196 Number of observations/statistics: 100/200

Information Criteria: | df Penalty | Parameters Penalty | Sample-Size Adju AIC: 146.8226 546.8226 547. BIC: -361.1856 559.8484 544. CFI: NA TLI: 1 (also known as NNFI) RMSEA: 0 [95% CI (NA, NA)] Prob(RMSEA <= 0.05): NA To get additional fit indices, see help(mxRefModels) timestamp: 2022-05-01 10:04:52 Wall clock time: 0.3507566 secs optimizer: SLSQP OpenMx version number: 2.19.6.6 Need help? See help(mxSummary) ```

Related work

umx() is a sister R package that bridges the gap between lavaan and OpenMx. If you are coming from lavaan it is perhaps useful to check umx() too. Onyx is a software that allows you to design nice diagrams, and syncs (exports and imports) the diagrams with OpenMx code.

Community and getting help

  1. The support communication is centered around the OpenMx forum
  2. Also, but less often, at the StackOverflow OpenMx tag.

Training

We gather annually in beautiful Boulder, CO for the international workshop for traning in behavioral genetics applications of OpenMx.

Contributing

How can I contribute to this project?
OpenMx is maintained by a small team and all help is appreciated. First read the team's conduct policy [here](https://github.com/OpenMx/OpenMx/blob/master/CONTRIBUTING). If you agree with it you can choose one of the below paths: 1. Do you have a well documented script (from one of our several workshops) that would make a great vignette? Great, because you don't even need to know how to use git. Simply go to the vignette folder and click in add file. This will automate the forking and uploading. 2. There are several issues that can be handled by new users. Go over to our oldest issues [here](https://github.com/OpenMx/OpenMx/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc), browse until something you find an issue you feel you can contribute to, and announce that you are planning to tackle it in the issue thread. 3. Have a completely new functionality that you want to discuss? Just create a PR and we will discuss whether it aligns with the package direction. In this case please add proper documentation for the new functionality. If you use RStudio there is a stub at File > New File > R Documentation. Also create a test unit in the tests/testthat folder, we currently use [testthat](https://testthat.r-lib.org/) to manage this.

Owner

  • Name: OpenMx
  • Login: OpenMx
  • Kind: organization
  • Location: Virginia

Structural Equation Modeling package for R

GitHub Events

Total
  • Issues event: 45
  • Watch event: 6
  • Issue comment event: 117
  • Push event: 87
  • Pull request event: 3
  • Fork event: 1
  • Create event: 3
Last Year
  • Issues event: 45
  • Watch event: 6
  • Issue comment event: 117
  • Push event: 87
  • Pull request event: 3
  • Fork event: 1
  • Create event: 3

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 8,916
  • Total Committers: 50
  • Avg Commits per committer: 178.32
  • Development Distribution Score (DDS): 0.675
Past Year
  • Commits: 278
  • Committers: 4
  • Avg Commits per committer: 69.5
  • Development Distribution Score (DDS): 0.09
Top Committers
Name Email Commits
Joshua Nathaniel Pritikin j****n@p****m 2,898
jpritikin j****n@d****1 1,449
mspiegel m****l@d****1 1,293
RMKirkpatrick r****2@v****u 1,249
mhunter1 m****u@g****m 264
mhunter m****r@d****1 253
Timothy Bates t****s@g****m 242
mhunter1 m****r@o****u 236
tbates t****s@d****1 203
tbrick t****k@d****1 194
restabrook r****k@d****1 90
skenny s****y@d****1 70
hmaes h****s@d****1 66
zaherym z****m@v****u 64
mzahery m****y@d****1 55
rkirkpatrick r****k@d****1 51
rgore r****e@d****1 42
sboker s****r@d****1 37
mneale m****e@d****1 30
mhunter1 M****1@o****u 17
jspies j****s@d****1 17
lf-araujo l****o@u****u 11
dhackett d****t@d****1 11
charles_driver c****s@g****m 9
Andrew Johnson a****n@a****m 8
rtm9zc r****c@v****u 8
yang y****g@d****1 5
Ben Goodrich g****n@g****m 5
mwilde m****e@d****1 4
Timothy R. Brick t****k@p****u 4
and 20 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 138
  • Total pull requests: 23
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 29 days
  • Total issue authors: 28
  • Total pull request authors: 12
  • Average comments per issue: 5.3
  • Average comments per pull request: 3.52
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 16
  • Pull requests: 3
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Issue authors: 5
  • Pull request authors: 2
  • Average comments per issue: 1.56
  • Average comments per pull request: 2.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • tbates (33)
  • mhunter1 (33)
  • RMKirkpatrick (22)
  • jpritikin (17)
  • jhorzek (5)
  • lf-araujo (4)
  • mcneale (3)
  • barracuda156 (2)
  • rbalint (2)
  • khusmann (2)
  • loveyu3317 (1)
  • davidshisui (1)
  • nileshpatra (1)
  • vandenman (1)
  • festerman (1)
Pull Request Authors
  • lf-araujo (8)
  • vandenman (2)
  • andrjohns (2)
  • rtm9zc (2)
  • eddelbuettel (2)
  • cjvanlissa (2)
  • hsbadr (1)
  • haozhou1988 (1)
  • jhorzek (1)
  • JPark93 (1)
  • khusmann (1)
Top Labels
Issue Labels
enhancement (23) bug (11) better errors (9) good first issue (7) help wanted (7) documentation (6) test suite (4) regression (4) code (3) 3.0 (2) summary (2)
Pull Request Labels
bug (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 13,406 last-month
  • Total docker downloads: 46,369
  • Total dependent packages: 24
  • Total dependent repositories: 37
  • Total versions: 60
  • Total maintainers: 1
cran.r-project.org: OpenMx

Extended Structural Equation Modelling

  • Versions: 60
  • Dependent Packages: 24
  • Dependent Repositories: 37
  • Downloads: 13,406 Last month
  • Docker Downloads: 46,369
Rankings
Docker downloads count: 0.6%
Forks count: 2.2%
Downloads: 2.5%
Average: 2.9%
Dependent packages count: 3.0%
Dependent repos count: 4.3%
Stargazers count: 4.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • MASS * imports
  • Matrix * imports
  • Rcpp * imports
  • RcppParallel * imports
  • digest * imports
  • lifecycle * imports
  • methods * imports
  • parallel * imports
  • covr * suggests
  • ggplot2 * suggests
  • ifaTools * suggests
  • knitr * suggests
  • lme4 * suggests
  • markdown * suggests
  • mvtnorm * suggests
  • numDeriv * suggests
  • reshape2 * suggests
  • rmarkdown * suggests
  • roxygen2 >= 6.1 suggests
  • rpf >= 0.45 suggests
  • snowfall * suggests
  • testthat * suggests
  • umx * suggests
middle/package.json npm
  • body-parser ~1.0.1
  • express >=4.5.0
util/docker/latest/Dockerfile docker
  • r-base latest build
util/docker/master/Dockerfile docker
  • r-base latest build
util/docker/release/Dockerfile docker
  • r-base latest build