# OpenMx

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/OpenMx
> Markdown URL: https://mediated.wiki/source/OpenMx.md
> Source: https://en.wikipedia.org/wiki/OpenMx
> Source revision: 1209737931
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Infobox programming language
| name                   = OpenMx
| logo                   = 200px
| paradigm               = [Structural Equation Modeling](/source/Structural_Equation_Modeling)
| designer               =OpenMx Team 
| developer              = [http://openmx.ssri.psu.edu/about-openmx-project The OpenMx Development Core Team]
| typing                 = [Dynamic](/source/Type_system)
| implementations        =
| dialects               =
| influenced             = [http://openmx.ssri.psu.edu/forums/third-party-software/metasem metaSEM]; [http://openmx.ssri.psu.edu/forums/third-party-software/simsem-and-semtools simsem and semTools], [http://openmx.ssri.psu.edu/forums/third-party-software/onyx Onyx], [https://CRAN.R-project.org/package=umx umx helper library]
| license                = [Apache License](/source/Apache_License), Version 2.0
| website                = [http://openmx.ssri.psu.edu openmx.ssri.psu.edu]
| wikibooks              = 
| year                   = 2010 <ref>[http://openmx.ssri.psu.edu/2010/09/openmx-100 Release 1.0] Announcing OpenMx 1, The OpenMx Development Team, available from the OpenMx website</ref>
| latest_release_version = 2.19.8 [https://CRAN.R-project.org/package=OpenMx]
| latest_release_date    = {{start date and age|2021|09|24}} 
| latest_test_version    = [https://github.com/OpenMx Beta]
| latest_test_date       = {{start date and age|2017|07|19}} 
| influenced_by          = [Mx](/source/Mx_(programming_language)), [R](/source/R_(programming_language))
| operating_system       = [Cross-platform](/source/Cross-platform)
}}

'''OpenMx''' is an [open source](/source/Open-source_software) program for extended [structural equation modeling](/source/structural_equation_modeling). It runs as a package under [R](/source/R_(programming_language)). Cross platform, it runs under Linux, Mac OS and Windows.<ref>S. Boker, M. Neale, H. Maes, M. Wilde, M. Spiegel, T. Brick, J. Spies, R. Estabrook, S. Kenny, T. Bates, P. Mehta and J. Fox. (2011). OpenMx: An Open Source Extended Structural Equation Modeling Framework. ''Psychometrika'', '''76''', [https://dx.doi.org/10.1007/s11336-010-9200-6]</ref>

== Overview ==

OpenMx consists of an R library of functions and optimizers supporting the rapid and flexible implementation and estimation of [SEM](/source/Structural_equation_modeling) models. Models can be estimated based on either raw data (with [FIML](/source/Full_information_maximum_likelihood_estimation) modelling) or on correlation or covariance matrices. Models can handle mixtures of continuous and ordinal data. The current version is OpenMx 2,<ref name="NealeHunter2015">{{cite journal|last1=Neale|first1=Michael C.|last2=Hunter|first2=Michael D.|last3=Pritikin|first3=Joshua N.|last4=Zahery|first4=Mahsa|last5=Brick|first5=Timothy R.|last6=Kirkpatrick|first6=Robert M.|last7=Estabrook|first7=Ryne|last8=Bates|first8=Timothy C.|last9=Maes|first9=Hermine H.|last10=Boker|first10=Steven M.|title=OpenMx 2.0: Extended Structural Equation and Statistical Modeling|journal=Psychometrika|volume=81|issue=2|pages=535–549|year=2015|issn=0033-3123|doi=10.1007/s11336-014-9435-8|pmid=25622929|pmc=4516707}}</ref> and is available on [CRAN](/source/R_(programming_language)).

[Path analysis](/source/Path_analysis_(statistics)), [Confirmatory factor analysis](/source/Confirmatory_factor_analysis), [Latent growth modeling](/source/Latent_growth_modeling), [Mediation analysis](/source/Mediation_analysis) are all implemented.  Multiple group models are implemented readily.  When a model is run, it returns a model, and models can be updated (adding and removing paths, adding constraints and equalities; giving parameters the same label equates them). An innovation is that labels can consist of address of other parameters, allowing easy implementation of constraints on parameters by address.

RAM models return standardized and raw estimates, as well as a range of fit indices ([AIC](/source/Akaike_information_criterion), [RMSEA](/source/RMSEA), [TLI](/source/Confirmatory_factor_analysis), [CFI](/source/Confirmatory_factor_analysis) etc.). Confidence intervals are estimated robustly.

The program has parallel processing built-in via links to parallel environments in R, and in general takes advantage of the R programming environment.

Users can expand the package with functions. These have been used, for instance, to implement Modification indices.

Models can be written in either a "pathic" or "matrix" form. For those who think in terms of path models, paths are specified using mxPath() to describe paths. For models that are better suited to description in terms of matrix algebra, this is done using similar functional extensions in the R environment, for instance mxMatrix and mxAlgebra.

The code below shows how to implement a simple [Confirmatory factor analysis](/source/Confirmatory_factor_analysis) in OpenMx, using either path or matrix formats. The model is diagrammed here:
center|One latent-factor <nowiki>{{Confirmatory factor analysis|CFA}}</nowiki> of 5 manifest (measured) variables.|529x529px

== Example path model specification ==

Below is the code to implement, run, and print a summary for estimating a one-factor path model with five indicators. 
<syntaxhighlight lang="r">

require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")

m1 <- mxModel("One Factor", type="RAM",
              manifestVars = manifests,
              latentVars = latents,
              mxPath(from=latents, to=manifests),
              mxPath(from=manifests, arrows=2),
              mxPath(from=latents, arrows=2, free=FALSE, values=1.0),
              mxData(cov(demoOneFactor), type="cov", numObs=500)
              )
summary(mxRun(m1))

</syntaxhighlight>

== Example matrix specification ==
Below is the code to implement, run, and print a summary for estimating a one-factor path model with five indicators. 
<syntaxhighlight lang="r">
library(OpenMx)
data(demoOneFactor)
df = cov(demoOneFactor)

m1 <- mxModel("One Factor",
              mxMatrix("Full", nrow = 5, ncol = 1, values = 0.2, free = TRUE,  name = "A"),
              mxMatrix("Symm", nrow = 1, ncol = 1, values = 1.0, free = FALSE, name = "L"),
              mxMatrix("Diag", nrow = 5, ncol = 5, values = 1.0, free = TRUE,  name = "U"),
              mxAlgebra(A %*% L %*% t(A) + U, name="R"),
              mxExpectationNormal(covariance= "R", dimnames = names(demoOneFactor)),
              mxFitFunctionML(),
              mxData(df, type = "cov", numObs=500)
              )
summary(mxRun(m1))
</syntaxhighlight>

== References ==
<references/>

== External links ==
* [https://web.archive.org/web/20170106011317/http://openmx.ssri.psu.edu/ Home Page]

{{DEFAULTSORT:Openmx}}
Category:Articles with example R code
Category:Free statistical software
Category:Structural equation models
Category:R (programming language)

---
Adapted from the Wikipedia article [OpenMx](https://en.wikipedia.org/wiki/OpenMx) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/OpenMx?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
