Model fails on being re-run filteredDataRow entity already exists

Hi, This still seems to be a bug in the OpenMx 2 beta 2.

Model with arow objective runs fine once, then dies the second time, trying to update "filteredDataRow"

OpenMx version: 2.0.0.3751
R version: R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0
Default optimiser: CSOLNP


# ===============================
# = Model fails on being re-run =
# ===============================

library(OpenMx)
# =================
# = 1. Make data set =
# =================
set.seed(159)
xdat <- data.frame(a=rnorm(10, mean=4.2), b=1:10)

With binary data omxSaturatedModel builds under-identified model

Mike Neale pointed this out in response to a user post.

http://openmx.psyc.virginia.edu/thread/3883#comment-5602

The saturated/independence models for binary data need to be modified a little be smartly depending on the number of categories in ordinal factors.

Error message is garbled in Windows

Sometimes error messages for NaN get garbled in Windows. See the thread below.

http://openmx.psyc.virginia.edu/thread/3881#comment-5574

exited abnormally with the error message: MxComputeGradientDescent: fitfunction Sat.fitfunction evaluated to 1.#QNAN0 ()

We need a script that generates this error. Rob alluded to there being one. And then we can try to fix the printing of the error message.

mxEval(formula, model, environment = model) # add environment

mxEval looks in the parent environments to find objects. This can be handy, allowing reference to such objects in algebra. However, when used in the context of getting things out of models (quite a common use-case), it can be dangerous: mxEval might return an object with the same name from the environment, rather than from inside the model you have set as the target.

Example. Say you have a matrix


m1$submodels$top$matrices$nVar$values
[,1]
[1,] 1

more flexible dimnames assignment: one vector, and rownames and colnames parameters

We quite often read and type things like


mxObject(…, dimnames = list(NULL, c("a", "b","c")))
# and
mxExpectationNormal(dimnames = list(c("a", "b","c"), c("a", "b","c")))

Add rownames and colnames parameters to allow:

mxObject(..., colnames = c("a", "b", 'c'))

in place of the harder to read

mxObject(…, dimnames = list(NULL, c("a", "b")))

Would be handy also to interpret a single vector input to dimnames as a list with both entries the same, i.e.:


mxObject(..., dimnames = c('a','b', 'c') )
# would function like:

implement [] in mxAlgebra/mxConstraint

[ (the bracket accessor function) is not listed as an implemented function in mxAlgebra.

It's handy, but not available in algebra or the algebra of a constraint:


# ======================================
# = 1. Try bracket access in mxAlgebra =
# ======================================
nOrd = 3
nVar = 5
fit1 = mxModel("fit1",
mxMatrix(name="a" , "Full", nrow=nVar, ncol=nVar, free=T, values=1:25),
mxMatrix(name="unit", "Unit", nrow=nOrd, ncol=1),
mxAlgebra(diag2vec(a)[1:3], name = "ordElements"),
mxConstraint(name = "con1", ordElements == unit),