Converting to and from OpenMx

Posted on
No user picture. twoertwein Joined: 12/11/2019

lavaan multi-level SEM in OpenMX

I'm trying to replicate this example two-level SEM from lavaan in OpenMx http://lavaan.ugent.be/tutorial/multilevel.html

Lavaan's log-likelihood is -23309.87 but with the following OpenMx code I get only -26495.56. I have also tried to use the estimated parameters from lavaan as fixed parameters in the OpenMx model - the log-likelihood gets even worse then. I assume that the model structure in OpenMx is not the same as the structure model in lavaan.

Posted on
No user picture. amr438 Joined: 03/09/2016

Converting ClassicMx script to OpenMx

Hello,

I am currently trying to recreate ClassicMx script for an ECOT model into OpenMx and I am coming across an error that I am not sure how to solve.
When I run the model I get the following error:

Error: The following error occurred while evaluating the subexpression 'solve(ecot.matF %*% solve(ecot.matI - ecot.matA) %*% ecot.matM %*% ecot.matU)' during the evaluation of 'MZtoss.expMeanMZtoss' in model 'modelECOT' : 'a' (4 x 1) must be square

I have attached the ClassicMX code and OpenMx code.

Posted on
Picture of user. tbates Joined: 07/31/2009

convert lavaan to OpenMx

It will often be easiest to simply recreate your model in OpenMx or to use umx’s umxRAM function. This will also lead to to nicer code, taking advantage of OpenMx’s features.

For automated translation of lavaan syntax into OpenMx, metaSEM provides the lavaan2RAM function.

Posted on
No user picture. CarolKan Joined: 04/17/2014
Posted on
Picture of user. Robert Long Joined: 02/22/2013

Converting a Stata -sem- path model

Hi all

I am trying to convert a simple path model from Stata. In Stata I use

clear all
ssd init EE DR RO SE
ssd set observations 321

ssd set sd 15.23 10.15 16.27 1.01

ssd set correlations ///
1 \ ///
0.25 1 \ ///
0.78 0.21 1 \ ///
-0.47 -0.27 -0.35 1

sem (SE -> EE) (EE -> DR) (EE -> RO) (DR -> RO), nocapslatent

This generates the following output


------------------------------------------------------------------------------
| OIM
| Coef. Std. Err. z P>|z| [95% Conf. Interval]

Posted on
Picture of user. HanOud Joined: 12/20/2009

THard=-n

I have had good experience with the Mx option THard=-n in Mx, also called Automatic Cold Restart. Is this option still available in OpenMx and, if not, why is it taken out?
Thanks for any answer in advance,
Han Oud
Posted on
Picture of user. suzannejak Joined: 01/06/2010

Wrong algebra?

I'm sorry if this is a too specific question, I tried to use the Python parser but I am totally unfamiliar with Python and can't get it working.

I keep finding differences between my Mx and OpenMx analysis and I think I must have made a mistake in translating the following algebra:

in Mx:

G = (Y-X)@(A.((A.A)*(V-J))) + X@(A.((U-I)*(A.A)));

in OpenMx (wrong?):

algebraG = mxAlgebra(expression = (Y-X) %x% (A*((A*A)%*%(V-J))) + X %x% (A * ((U-I)%*%(A*A))), name = "G")

Posted on
Picture of user. mspiegel Joined: 07/31/2009

converting Mx scripts

There is a python script in the OpenMx package that will convert simple Mx 1.0 scripts into OpenMx scripts. The script is called mxParser.py. It can be found either in the /tools directory (in a binary installation of OpenMx) or in the /inst/tools directory (in a source installation of OpenMx). You will need the python library "ply" to run the script. Use "sudo easy_install ply" to install the ply library on your machine. To use the script from an arbitrary location, modify your $PATH environment variable.
Posted on
Picture of user. jssteele Joined: 10/11/2009

A Perl based parser for Mplus syntax

UPDATE:
Version 0.3b available

UPDATE:
Newest version 0.2b handles PON and PWITH syntax. 

UPDATE:
I have attached a newer version of the .pm file. I would welcome suggestions if anyone has some. 

UPDATE:
This is a work in progress and is in need of some more work currently. Use at your own risk... you have been warned. :)

====original message below====

Greetings again,