Example:

Running modelThreshReparam3

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

This should read:

Running modelThreshReparam3

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

The expected covariance matrix is of dimension *4x4*, but the length of the dimnames in the objective function is *3*

A similar problem occurs when the two sides of an mxConstraint '==' are not of the same dimensions. The dimensions of both sides of the mxConstraint equation should be reported.

OK changes made.

Here's another, similar issue:

Running thresholdModelMod

Error in computeMatrixHelper(, model, :

non-conformable arrays

Error in summary(thresholdModelModrun <- mxRun(thresholdModelMod)) :

error in evaluating the argument 'object' in selecting a method for function 'summary'

Non-conformable arrays should really report the dimensions of the arrays and the operator in question, in order to help the user trace the source of the problem. Better still would be the array names as well, though obviously these could be the result of previous operations. So ideally we'd end up with something like this:

The "Result of (a+b*c)" has dimensions m rows and n columns and "array D" has p rows and q columns. Since the operator in use is %*% , the number of columns in "Result of (a+b*c)" must equal the number of rows in "array D", which it does not.

I know from experience that crafting such error messages for all algebras etc. is not easy. However, if we can do this then the users will thank us over and over for saving them time debugging their scripts.

I did my best to hide the errors from the computeMatrixHelper function. Can you attach the script, and I'll take a look at it.

Sure, here it is.

I changed the error message to:

"Trying to evaluate 'thresholdModelMod.ageRegressedMeans' in model 'thresholdModelMod' generated the error message: non-conformable arrays"

It's not quite as detailed as you would like, but it's better than the earlier version. The difficulty with showing the full expression that caused the error is caused by the fact that the expressions need to be translated into a form that be calculated. But then when an error occurs, showing the error to the user should display the untranslated expression. At some point mxEval() might get completely rewritten. For the moment, we lose the untranslated version during evaluation.