OpenMx: An package for Structural Equation Modeling and Matrix Algebra Optimization
OpenMx is a package for structural equation modeling, matrix algebra optimization and other statistical estimation problems.
Try the example below. We try and have useful help files: for instance help(
mxRun) to learn more. Also the reference manual
OpenMx solves algebra optimization and statistical estimation problems using matrix algebra. Most users use it for Structural equation modeling.
The core function is
mxModel, which makes a model. Models are containers for data, matrices,
algebras, bounds and constraints. Models most often have an expectation function (e.g.,
to calculate the expectations for the model. Models need a fit function. Several of these are built-in (e.g., mxFitFunctionML )
OpenMx also allows user-defined fit functions for purposes not covered by the built-in functions. (e.g., mxFitFunctionR or mxFitFunctionAlgebra).
Once built, the resulting mxModel can be run (i.e., optimized) using
mxRun. This returns the fitted model.
You can see the resulting parameter estimates, algebra evaluation etc using
The user's manual is online (see reference below), but functions mxRun, mxModel, mxMatrix all have working examples to get you started as well.
The main OpenMx functions are: mxAlgebra, mxBounds, mxCI, mxConstraint, mxData, mxMatrix, mxModel, and mxPath
Expectation functions include mxExpectationNormal, mxExpectationRAM, mxExpectationLISREL, and mxExpectationStateSpace;
Fit functions include mxFitFunctionML, mxFitFunctionAlgebra, mxFitFunctionRow and mxFitFunctionR.
OpenMx comes with several useful datasets built-in. Access them using data(package="OpenMx")
To cite package 'OpenMx' in publications use:
Michael C. Neale, Michael D. Hunter, Joshua N. Pritikin, Mahsa Zahery, Timothy R. Brick Robert M. Kickpatrick, Ryne Estabrook, Timothy C. Bates, Hermine H. Maes, Steven M. Boker. (in press). OpenMx 2.0: Extended structural equation and statistical modeling. Psychometrika. DOI: 10.1007/s11336-014-9435-8
Steven M. Boker, Michael C. Neale, Hermine H. Maes, Michael J. Wilde, Michael Spiegel, Timothy R. Brick, Jeffrey Spies, Ryne Estabrook, Sarah Kenny, Timothy C. Bates, Paras Mehta, and John Fox. (2011) OpenMx: An Open Source Extended Structural Equation Modeling Framework. Psychometrika, 306-317. DOI:10.1007/s11336-010-9200-6
Steven M. Boker, Michael C. Neale, Hermine H. Maes, Michael J. Wilde, Michael Spiegel, Timothy R. Brick, Ryne Estabrook, Timothy C. Bates, Paras Mehta, Timo von Oertzen, Ross J. Gore, Michael D. Hunter, Daniel C. Hackett, Julian Karch, Andreas M. Brandmaier, Joshua N. Pritikin, Mahsa Zahery, Robert M. Kirkpatrick, Yang Wang, and Charles Driver. (2016) OpenMx 2 User Guide. http://openmx.psyc.virginia.edu/docs/OpenMx/latest/OpenMxUserGuide.pdf
The OpenMx User's guide can be found at http://openmx.psyc.virginia.edu/documentation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
library(OpenMx) data(demoOneFactor) # =============================== # = Make and run a 1-factor CFA = # =============================== latents = c("G") # the latent factor manifests = names(demoOneFactor) # manifest variables to be modeled # ==================== # = Make the MxModel = # ==================== 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) ) # =============================== # = mxRun it and get a summary! = # =============================== m1 = mxRun(m1) summary(m1, show = "std")
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.