You are here

expected [covariance|means] matrix does not contain dimnames.

1 post / 0 new
mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
expected [covariance|means] matrix does not contain dimnames.

These errors occur when the mxFIMLObjective has no dimnames for the covariance or means, and cannot find them elsewhere (i.e., in the target algebra). For example:

    model <- mxModel("univSat4", 
        mxMatrix(type="Symm", nrow=1, ncol=1, free=T, values=1, name="expCov"),
        mxMatrix(type="Full", nrow=1, ncol=1, free=T, values=0, name="expMean"),
        mxData(observed=testData, type="raw"),
        mxFIMLObjective(covariance="expCov", means="expMean"))
    fit <- mxRun(model)

Suggested solutions:

  • Add dimnames to the covariance and means matrices.

      mxMatrix("Symm", 1, 1, T, 1, name="expCov", dimnames=list(selVars, selVars),
      mxMatrix("Full", 1,1, T, 0, name="expMean", dimnames=list(selVars, selVars)),
    
  • Add dimnames to the objective function. Keep in mind that the objective function does not actually have row and columns names. The 'dimnames' argument to the objective function is a convenient shortcut for adding dimnames to the covariance and means matrices.
      mxFIMLObjective(covariance="expCov", means="expMean", dimnames=selVars)