Hi.
I am running a bivariate moderation model and would like to set some constraints in order to test for some nonlinear effects. I am struggling though with adding new algebras into submodels (with subsequent equating them). Let's say that I specify
pathAm <- mxMatrix(name = "am", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("amM","amC","amU"), values=pathVal) pathCm <- mxMatrix(name = "cm", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("cmM","cmC","cmU"), values=pathVal) pathEm <- mxMatrix(name = "em", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("emM","emC","emU"), values=pathVal) pathAf <- mxMatrix(name = "af", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("afM","afC","afU"), values=pathVal) pathCf <- mxMatrix(name = "cf", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("cfM","cfC","cfU"), values=pathVal) pathEf <- mxMatrix(name = "ef", type = "Lower", nrow = nv, ncol = nv, free=T, labels = c("efM","efC","efU"), values=pathVal)
and so on in the model CholACEModel
(with MZM, DZM, MZF and DZF as submodels).
I would like to introduce certain constraints and test the submodels against CholACEModel
:
amC/amM=cmC/cmM=emC/emM=betaM
afC/afM=cfC/cfM=efC/efM=betaF
but am not sure how I should proceed. Let's say I specify
NonlinearEfModel = mxModel (CholACEModel, name='NonlinearEf') bM = mxAlgebra(amC/amM, name='betaM') bM = mxAlgebra(cmC/cmM, name='betaM') bM = mxAlgebra(emC/emM, name='betaM') bF = mxAlgebra(afC/afM, name='betaF') bF = mxAlgebra(cfC/cfM, name='betaF') bF = mxAlgebra(efC/efM, name='betaF')
but how should I put all these new algebras into the model? Should I specify MZM, DZM, MZF and DZF models again?
And is it a right way to equate the algebras by giving them the same name? Would that work?
Thank you beforehand!
Julia
Hi Julia,
My understanding is if you want two algebras to be equal, then you use mxConstraint.
By constraining betaMA==betaMC and betaMC==betaME, this implies that betaMA==betaME.
With regard to your questions about how to add these, I'd like some clarification. Are you trying to set up a model 'NonlinearEfModel' that is identical to 'CholACEModel', but with these added constraints? That would be Option 1 in the code above. Option 1 does not create a submodel in the OpenMx sense. It creates a new model by adding things to a model that already existed. This is a nested model is the statistical sense: 'NonlinearEfModel' nested as a special case of 'CholACEModel'.
If Option 1 is not what you intended, please let me know so I can help.
Hey!
Sorry, completely missed your answer! Thanks a lot, this is exactly what I needed!