We added an optional 'dimnames' argument to the functions mxFIMLObjective() and mxMLObjective(). The argument expects a vector of character, such as c('foo', 'bar', 'baz'). The objective function uses this vector to populate the column names of the means vector, and the row and column names of the covariance matrix. With the 'dimnames' argument it is no longer necessary to explicitly specify the dimnames of the means and covariances, although it is still possible. If dimnames are specified for the means or covariances matrices, and the 'dimnames' argument is used by the objective function, and the dimnames values are not identical, then an error is thrown.
The demos and Sphinx documentation has been updated as well.
that's a nice feature michael.
I wonder if mxRun could be more specific when if finds an un-dimensioned mxMLObjective?
> fit <- mxRun(model)
Running ACE
Error: The expected covariance matrix associated with the ML objective in model 'ACE' does not contain dimnames.
nb: The expected covariance matrix which lacks dimnames is in a submodel of "ACE" called "modelMZ", and "ACE" uses an mxAlgebraObjective.... so a more helpful error would say "Error: The expected covariance matrix associated with the ML objective in 'ACE' sub-model "modelMZ" does not contain dimnames."
Fixed in revision 912.
mxMLObjective ? code doesn't run: complains about no dimnames.
Is this the fix?
A <- mxMatrix(values = 0.5, nrow = 2, ncol = 1,
free = TRUE, name = "A")
D <- mxMatrix(type = "Diag", values = c(0, 0.5),
free = c(FALSE, TRUE), nrow = 2, name = "D")
expectedCov <- mxAlgebra(A %*% t(A) + D, "expectedCov")
observedCov <- mxData(matrix(c(1.2, 0.8, 0.8, 1.3), nrow = 2, ncol = 2), 'cov', numObs = 150)
objective <- mxMLObjective(covariance = "expectedCov", dimnames=c('x','y'))
model <- mxModel("mxMLObjective example", A, D, expectedCov, objective, observedCov)
summary(mxRun(model))
PS: Those dimnames are not applied in the summary.
Fixed in r910
Fixed in r911.