You are here

Moving scripts from OpenMx 1 to OpenMx 2

Primary tabs

Very little will break from openMx 1 to OpenMx 2, but most scripts from pre 2012 can beneficially be updated for OpenMz 2.x to gain new functionality.

An example is referenced here

The user had hassles with:

1. No path to the genepihelper functions

Solution 1: Include web urls rather than disk-based filepaths

so

 source("http://www.vipbg.vcu.edu/~vipbg/Tc24/GenEpiHelperFunctions.R")

Solution 2: Use CRAN-based helpers, like umx and ezmx

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 algebra two-step calls like this:

minus2ll <- mxAlgebra( expression = MZ.objective + DZ.objective, name="m2LL")
obj  <- mxAlgebraObjective("m2LL")

You should replace "mxAlgebraObjective" with “mxFitFunctionAlgebra

However, there is a nice Multigroup function which handles this in one line and enables identification checks, ref model generation etc.

So just replace the whole thing with:

 mxFitFunctionMultigroup(c("MZ", "DZ"))}