You are here

simsem and semTools

5 posts / 0 new
Last post
Aschoemann's picture
Offline
Joined: 02/11/2013 - 14:21
simsem and semTools

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 - 15:14
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

neale's picture
Offline
Joined: 07/31/2009 - 15:14
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

Aschoemann's picture
Offline
Joined: 02/11/2013 - 14:21
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.

vozpre's picture
Offline
Joined: 09/20/2016 - 15:45
Nonconverged replications, model misspecifications and more

Hi Alex,

Hope this forum is still active, since I just started using simsem and find it very useful.
I have a couple of questions:
1. What happens with nonconverged replications in summary(sim(...))? Are they excluded from the results by default or do I need to specify their exclusion?
2. I tried obtaining results of a simulation based on a misspecified CFA model by correlating errors of two indicators that are not on the same latent variable, but the results of the simulation are the same as in the model that is properly specified. Does sim() register this type of misspecification or should I stick to the cross-loadings?
3. Does varying method of estimation in cfa() function from lavaan has an effect on simulation process? For example, I see no difference in simulation results when WLSMV, MLM or ULSMV were used with categorical data.

Thank you for your help,
Silvia