I think the subject says it, but I think it's awkward to have to type:
cov2cor(data.matrix(data)) - cov2cor(model$objective@info$expCov)
It seems like it would be simple to have a class (is that the term?) for the residuals function that operates on an mxobject. I often find myself looking at the residual covariance matrix to see where misfit lies.
the umx helper package (now) has an S3 function implementing residuals()
Let me know how it works for you
Great! Thanks for doing that.
Hi all,
My previous code for extracting residuals quit working. I remembered starting this topic and it seems that tbates's code no longer works either. Has OpenMx changed (again) how one calls the expected covariance matrix? If so, how do I access it? Is there a way to call it that won't change in the future? (I've got a package that depends on that and would hate to have to change it with each OpenMx update).
After a whole lot of fiddling, I figured out how you can extract the expected covariance matrix:
model$objective[[2]]@info$expCov
So, we've got an S3 object (expCov) within an S4 object (info) within a list ([[2]]) within an S3 object (objective). Weird. By the way, I'm on R 3.1.1 and OpenMx_999.0.0-3473. I'm not sure if this is the most recent version, but I'm afraid I'll break everything if I update. :)
Okay....I bit the bullet and updated OpenMx. Now it works as it used to (i.e., without the [[2]]):
model$objective@info$expCov
model$objective is deprecated. Also, use of @ is deprecated. Can you try model$expectation$UnfilteredExpCov ?
That doesn't work for me. Does it work on your end?