Error: The expected covariance matrix associated with the FIML objective in model 'MZ' is not of the same length as the dimnames

2 replies [Last post]
newsomjr's picture
Offline
Joined: 10/13/2009

I received this error when trying to run a latent growth curve model:

Error: The expected covariance matrix associated with the FIML objective in model 'MZ' is not of the same length as the dimnames provided by the objective function.

I used the traceback() function to try to determine the error and received the following output:

9: stop(msg, call. = FALSE)
8: updateObjectiveDimnames(.Object, job, model@name, "FIML")
7: genericObjModelConvert(flatObjective, job, model, namespace,
flatJob)
6: genericObjModelConvert(flatObjective, job, model, namespace,
flatJob)
5: translateObjectivesHelper(job, submodel, namespace, flatJob)
4: translateObjectivesHelper(model, model, namespace, flatModel)
3: translateObjectives(model, namespace, flatModel)
2: runHelper(model, frontendStart, intervals, silent, suppressWarnings,
unsafe, checkpoint, useSocket)
1: mxRun(lgcACEModel)

I am not sure how to interpret this message, or how to correct the script. Any help would be greatly appreciated! I have attached my script, and can upload my data if that is helpful.

Thank you!

newsomjr's picture
Offline
Joined: 10/13/2009
I do not think my scrip

I do not think my scrip attached, so I am trying again.

AttachmentSize
LCG.R 8.57 KB
mspiegel's picture
Offline
Joined: 07/31/2009
The expected covariance

The expected covariance matrix must have row and column names. In this case, you are using the dimnames = selVars argument of the mxFIMLObjective() as a shorthand for placing row and column names on the expected covariance matrix. Your data must contain column names, and the column names should match the dimnames of the expected covariance matrix (although they don't have to be in the same order). You should assign a variable to the value data.frame(dzData,dzDefs) and then use the colnames() function to determine the column names.