simsem and semTools

3 replies [Last post]
Aschoemann's picture
Offline
Joined: 02/11/2013

Welcome to the simsem and semTools forum! simsem and semTools are R packages (available on CRAN) that provide additional functionality for structural equation modeling in R.

simsem provides comprehensive simulation functionality for structural equation modeling. simsem allows data generation based on a user specified model, analyses of generated data, and storage and processing of simulation results. Data generation and analysis models using can be specified using lavaan syntax, or OpenMx model specifications, or a set of matrices.

For further details on simsem see: http://simsem.org

semTools is a package comprised of useful functions for structural equation modeling in R. semTools is designed to be a user supported package and all users of SEM and R are encouraged to submit functions of ideas for additional functions. semTools includes the functions, fitMeasuresMx, nullMx, and saturateMx, which compute fit measures, a null model and a saturated model with OpenMx.

For more information on semTools see: https://github.com/simsem/semTools/wiki

Thanks,

-Alex

neale's picture
Offline
Joined: 07/31/2009
Got an error with fitMeasuresMx

I found semTools' fitMeasuresMx works fine with the model on the OpenMx homepage, but not with the attached. I got this rather odd error message:

> fitMeasuresMx(growFit)
Error in LAMBDA %*% FacMean :
requires numeric/complex matrix/vector arguments

AttachmentSize
ARmodel.R 5.07 KB
Aschoemann's picture
Offline
Joined: 02/11/2013
Order of mxAlgebra

Hi Mike,

It seems that for fitmeasuresMX to work, the order of mxAlgebra items specified matters. Specifically, if one mxAlgebra (ma1) object references another (ma2), then in the mxModel funtion, ma2 should be listed before ma1.

By changing lines 111-112 in ARmodel.R from:

growModel <- mxModel("LGM", LAMBDA, BETA, GAMMA, PHIchol, PHI, PSI, EPSILON, IDEN,
                            ManMean, GroMean, FacMean, expCov, dat, GrowObj)

to:

growModel <- mxModel("LGM", LAMBDA, BETA, GAMMA, PHIchol, PHI, PSI, EPSILON, IDEN,
                           GroMean, FacMean, ManMean, expCov, dat, GrowObj) 

fit indices are returned.

neale's picture
Offline
Joined: 07/31/2009
Looks great, needs R >= 2.15

Very enticing! I note that the version for R 2.14 on CRAN has very few of the documented functions (it's 0.1 vs 0.3.2 available on github). One seems to need R >= 2.15.

Cheers
Mike