mxFitFunctionMultigroup creates a fit function consisting of the sum of the fit
statistics from a list of submodels provided. This is conceptually similar to creating an mxAlgebra consisting of the sum of
the subModel objectives and also creating an algebra fit function to optimize the
model based on this aggregate value.
This call to mxFitFunctionMultigroup:
mxFitFunctionMultigroup(c("model1", "model2"))
then, is almost equivalent to the following pair of statements:
mxAlgebra(model1.objective + model2.objective, name="myAlgebra")
mxFitFunctionAlgebra("myAlgebra")
In addition to being more compact and readable, using mxFitFunctionMultigroup has
additional side effects which are valuable for multi-group modeling.
Firstly, it aggregates analytic derivative calculations. Secondly, it allows mxRefModels
to compute saturated models for raw data, as this function can learn which are the constituent submodels.
Note: You can refer to the algebra generated by mxFitFunctionMultigroup when used in a group "modelName"
as:
modelName.fitfunction