Hi All:

I just got this strange error message when I ran the script below (trying to use a covariance matrix rather than raw data).

Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings, :

BLAS/LAPACK routine 'DSYMM ' gave error code -9

Here is the script that generated the error:

require(OpenMx)

source("http://www.vipbg.vcu.edu/~vipbg/Tc24/GenEpiHelperFunctions.R")

mzCov
dimnames=list(c("y1", "y2"), c("y1", "y2")))

dzCov
dimnames=list(c("y1", "y2"), c("y1", "y2")))

# Fit Multivariate ACE Model using Cholesky Decomposition

# -----------------------------------------------------------------------

Vars

nv selVars

ntv mzData dzData

# Fit Multivariate ACE Model using Cholesky Decomposition

# -----------------------------------------------------------------------

multACEModel
mxModel("ACE",

# Matrices a, c, and e to store a, c, and e path coefficients

mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=.6,label=c("a11", "a21","a22"), name="a" ),

mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=.6,label=c("c11", "c21","c22"), name="c" ),

mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=.6,label=c("e11", "e21","e22"), name="e" ),

# Matrices A, C, and E compute variance components

mxAlgebra( expression=a %*% t(a), name="A" ),

mxAlgebra( expression=c %*% t(c), name="C" ),

mxAlgebra( expression=e %*% t(e), name="E" ),

# Algebra to compute total variances and standard deviations (diagonal only)

mxAlgebra( expression=A+C+E, name="V" ),

mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I"),

mxAlgebra( expression=solve(sqrt(I*V)), name="isd"),

# Matrix & Algebra for expected means vector

# mxMatrix( type="Full", nrow=1, ncol=nv, free=TRUE, values= .5, name="M" ),

# mxAlgebra( expression= cbind(M,M), name="expMean"),

# Algebra for expected variance/covariance matrix in MZ

mxAlgebra( expression= rbind ( cbind(A+C+E , A+C),

cbind(A+C , A+C+E)), name="expCovMZ" ),

# Algebra for expected variance/covariance matrix in DZ, note use of 0.5, converted to 1*1 matrix

mxAlgebra( expression= rbind ( cbind(A+C+E , 0.5%x%A+C),

cbind(0.5%x%A+C , A+C+E)), name="expCovDZ" )

),

mxModel("MZ",

mxData(observed=dzCov , type="cov", numObs=100 ),

mxMLObjective( covariance="ACE.expCovMZ", dimnames=selVars )

),

mxModel("DZ",

mxData( observed=dzCov , type="cov", numObs=100 ),

mxMLObjective( covariance="ACE.expCovDZ", dimnames=selVars )

),

mxAlgebra( expression=MZ.objective + DZ.objective, name="2sumll" ),

mxAlgebraObjective("2sumll")

)

multACEFit multACESumm multACESumm

Congratulations!

You just found a bug in OpenMx. I'm in the process of investigating, and we'll get back to you with a fix as soon as we can.

Thanks for finding this.

I believe that ACE.expCovMZ and ACE.expCovDZ are 4 x 4 matrices but the observed covariance matrices are both 2 x 2 matrices. Can someone confirm this? I'll add error checking to ML to ensure that the dimensions match up.

That lines up with everything I'm seeing. Checking the math, it looks right as well.

When I change the observed covariances to 4x4 matrices, it runs fine.

If this is intended to be a bivariate model of twin pairs, that also lines up--two measurements per person times two twins per pair should yield four measurements in every row. That means the covariance matrix should be 4x4.

bverhulst, your quick fix is just to add rows and columns to your observed covariance matrix to make it 4x4. We'll add the error checking so that the error you'll get back in the future will make more sense.

Thanks again for your help!

That seems to work. I ended up just scrapping everything and starting over and the second time it worked without a problem, but I thought I would post the very strange error message anyway.

Thanks again,

Brad

The error message in OpenMx 1.0.5 for this script will be:

`Error: The dimensions for the expected covariance matrix and the observed covariance matrix in the ML objective in model 'MZ' are not identical.`

I actually have a related question to this. Is it permissible to supply a data Cov matrix bigger than the expected one and then the program select relevant the block by the dim names given in the ML objective function? If my memory serves, the FIML can select some columns from the data matrix, leaving others out (e.g. instrumental variables).

Thanks.

Hao

Yes, that will work. The dimnames argument selects rows and columns from the data covariance matrix. The order of variables in the dimnames argument will be used to select variables; if you supply a dimnames argument of c("y1", "y5", "y3") that corresponds to a dataset with variables y1-y5 in that order, then the 1st, 5th and 3rd rows & columns of the data will be compared to the 1st, 2nd and 3rd rows & columns of the expected covariance matrix.

Ryne,

Thank you very much for the quick reply. But I found it does not work. Would you have a look at the code below?

Below is an example, where varnames include 8 variable names, and varnames0 four of those eight. Upon running the mxRun line, it says

Error: The dimnames for the expected covariance matrix and the observed covariance matrix in the ML objective in model 'ACEModelMZ' are not identical.

require(OpenMx)

varnames varnames0 dataMZ

p pstar nMZ=100;

nDZ=100;

LA LC LE

A C E

ACESigmaMZ ACESigmaDZ

ACEModelMZ mxMLObjective(covariance="ACEModelTwin.ACESigmaMZ",dimnames=varnames0),

mxData(observed=dataMZ,type="cov",numObs=nMZ));

ACEModelDZ mxMLObjective(covariance="ACEModelTwin.ACESigmaDZ",dimnames=varnames0),

mxData(observed=dataDZ,type="cov",numObs=nDZ));

twin ACEModelTwin ACESigmaMZ,ACESigmaDZ,ACEModelMZ,ACEModelDZ,twin,

mxAlgebraObjective("twin"));

mxRun(ACEModelTwin)

No, for ML estimation the expected covariance and observed covariance matrices must have identical dimensions and of identical dimnames.

Oops, thanks Mike. I didn't realize we had that inconsistency between ML and FIML.

Hao, your code runs on my machine, but yields a code 6, which I assume is because you used the identity matrix as a data example. I did not get a conformability error, despite Mike's comment.

The error checking was added in OpenMx 1.0.6

I'm probably in the 1.0.5 range then. Thanks again.

Thank you, Mike and Ryne, for the replies.