mxEval with Run State Space Model

Charles Driver found this odd behavior: http://openmx.psyc.virginia.edu/thread/3948

On a state space expectation model that has been run, mxEval does not correctly find/use at least some definition variables.


require(OpenMx)

data(demoOneFactor)
nvar <- ncol(demoOneFactor)
varnames <- colnames(demoOneFactor)
demoOneFactorInputs <- cbind(demoOneFactor, V1=rnorm(nrow(demoOneFactor)))
ssModel <- mxModel(model="State Space Inputs Manual Example",
mxMatrix("Full", 1, 1, TRUE, .3, name="A"),
mxMatrix("Full", 1, 1, TRUE, values=1, name="B"),

mxRefModels does not work with inherited data

OpenMx models support inheriting data from a parent, but the mxRefModels function chokes on this.


require(OpenMx)

data(demoOneFactor)
latents = c("G")
manifests = names(demoOneFactor)

m1 <- mxModel("model1", type = "RAM",
manifestVars = manifests, latentVars = latents,
mxPath(from = latents, to = manifests),
mxPath(from = manifests, arrows = 2),
mxPath(from = latents, arrows = 2, free = F, values = 1.0)
)
m2 <- mxModel("model2", type = "RAM",
manifestVars = manifests, latentVars = latents,

error msg: typecheck incoming covCols covRows to verifyMvnNames (file MxExpectationNormal.R)

in file MxExpectationNormal.R
verifyMvnNames()
attempts this:

(length(covRows) != length(covCols)) || !all(covRows == covCols))

covRows gets covDimnames[[1]]
covDimnames gets dimnames(covariance)
and covariance is flatModel[[covName]]

so the problem was embedded in an incoming flatModel (exerpted snippet below).

I am guessing that we are letting people set dimnames incorrectly outside the this code...


verifyMvnNames <- function(covName, meansName, type, flatModel, modelname, expectationName) {
covariance <- flatModel[[covName]]

tell people what is actually happening

re user issue http://openmx.psyc.virginia.edu/thread/1111

As Mikee N says,

if(fit function < definite & evaluations <3 & free parameters > 0){
message("your starting values are too far off reality for me find my way home...
You might try setting the means to their actual values (that often flumoxes me), and perhaps get the covariances closer to realistic values for me, but certainly start by setting each variable's mean to its actual value to give me a hint..."
}

re mxTryHard()

Would it be wise to set scale to .05 by default?

Error in models/passing/InitializationErrorDetection.R

With revision 3958, I get an error in one model in the test suite, models/passing/InitializationErrorDetection.R , namely, "Error: An error was thrown with the wrong message: Observed argument is neither a data frame nor a matrix". Both of the first two omxCheckError() statements trigger it.

If this error reflects a real problem with our code, then of course the problem should be fixed. If not, then we just need to edit this test model so it doesn't fail.