This code used to work using "mxAlgebraObjective", but now says I have to use "mxFitFunctionAlgebra" instead of "mxAlgebraObjective".
#
models_1_v4 <- mxModel("Models_1",
Model_1_t1_v4,
Model_1_t2_v4,
mxAlgebra(
Model_1_t1_v4.objective+
Model_1_t2_v4.objective,
name="multi"),
mxAlgebraObjective("multi"),
mxFitFunctionAlgebra(algebra = "multi")
)
m1_fit_v4 <- mxRun(models_1_v4)
#
I tried changing ".objective" to ".fitfunction" but this did not work either. What am I doing wrong?
I believe
.objective
still works. Give that a try.Also, consider using
mxFitFunctionMultiGroup()
instead of an algebra fitfunction for this kind of thing.Thanks. I figured out what was wrong. I was using the wrong names for the sub-models.
Is it possible to use mxFactorScores with the higher level model - that is, the model containing the submodels?
One benefit of the
mxFitFunctionMultigroup()
is that is allows you, in many cases, to get the factor scores from a multigroup model. It gives you a list of factor scores arrays. Each element of the list corresponds to one of the groups.See this: https://github.com/OpenMx/OpenMx/blob/master/inst/models/nightly/FactorScores.R#L191-L209