There are a small number of changes from OpenMx 1.0 to 2.0 and higher. Nearly all scripts will run fine, but some pre-2012 or will benefit in features if you update for OpenMx 2.x
An example is referenced here
The user had hassles with:
1. No path to the helper functions
This is a more generic robustness issue for example R code: better to include web urls rather than disk-based file paths.
source("http://www.vipbg.vcu.edu/~vipbg/Tc24/GenEpiHelperFunctions.R")
A better solution is CRAN-based helper packages like umx. These are easier to keep up to date and accessible.
2. Old-style objectives (instead of expectations and fit functions)
Calls like this one are deprecated:
objMZ<- mxFIMLObjective(covariance="expCovMZ", means="expMean", dimnames=selVars)
It’s easy to update these across a stack of scripts, replacing mxFIMLObjective
with mxExpectationNormal
+ a call to mxFitFunctionML
In addition, in old-style multiple-group objectives like this:
minus2ll <- mxAlgebra( expression = MZ.objective + DZ.objective, name="m2LL")
obj <- mxAlgebraObjective("m2LL")
You should replace mxAlgebraObjective
with mxFitFunctionAlgebra
However, OpenMx 2 has a neat Multigroup function which handles this in one line and enables identification checks, reference model generation etc.
So just replace the whole thing with (for example):
mxFitFunctionMultigroup(c("MZ", "DZ"))}