Default M matrix in type="RAM" models

4 replies [Last post]
Ryne's picture
Joined: 07/31/2009

Hi all,

I'm writing a simple latent change score demo using mxPath, and found something interesting. I believe we've talked about default means models before, but I don't recall.

In this model, two occasions of data (wisc1 and wisc6 below) are restated as the first occasion (wisc1) and a change or difference score (diff). As such, the second observation (wisc6) is fully explained, and has no intercept and no residual. By default, specifying 'type="RAM"' assigns freely estimated manifest means, so the code below actually has three means for two manifest variables. The easy thing is just to add an extra path function, specifying a fixed intercept of zero for wisc6. I'm asking a design question, however: should I have to override a default and tell OpenMx not to give wisc6 a mean?

x <- matrix(c(40.658, 50.686, 50.686, 108.014), nrow=2)
y <- c(18.781, 47.341)
example <- mxModel("My Title",
  mxData(x, type="cov", means=y, numObs=204),
  manifestVars=c("wisc1", "wisc6"),
  mxPath(c("wisc1", "diff"), "wisc6",
    TRUE, 1, FALSE, 1, NA),
  mxPath(c("wisc1", "diff"), c("wisc1", "diff"),
    FALSE, 2, TRUE, 45, c("v_1", "v_d")),
  mxPath("wisc1", "diff", 
    FALSE, 2, TRUE, 10, "cov_1d"),
  mxPath("one", c("wisc1", "diff"),
    FALSE, 1, TRUE, 1, c("mean1", "mean_diff"))

Steve's picture
Joined: 07/30/2009
My take is that yes, you

My take is that yes, you should have to override a default. Having a means vector implies that you want to do something with the means. That you aren't is only a function of your particular model.

Ryne's picture
Joined: 07/31/2009
Two points: -I have data,

Two points:
-I have data, which implies I want to do something with it. There are no other default parameters included in OpenMx. Why should we assume a fully saturated means model and a complete lack of specification for the covariance model?

-I have a secondary issue with a default, unnamed parameter. It is a default that will in, virtually all cases, have to be overridden, either to remove the parameter or name it so I can more easily interpret and edit it. If an analyst thought "OpenMx does exactly what you tell it to," they might not notice the extra parameter. This could easily be an issue with categorical data models, where one may not want manifest means.

Steve's picture
Joined: 07/30/2009
OK. I stand corrected. In

OK. I stand corrected.

In yesterday's developer's meeting we discussed your case. Here are the issues we took into consideration:

1. When a RAM model is created, we should not add any paths by default. Any path that is added should be added by a user. This should hold for the A matrix, the S matrix as well as for the M matrix.

2. There are three cases when a means model is required (i.e., in mxData there is an argument type="raw", or type="sscp", or means=) . All three cases should act exactly the same.

3. If a means model is required but not specified the user should be alerted. We should not build a means model in the background. This is consistent with the OpenMx philosophy that everything is "out front" and visible in a script. Thus, an error should be generated if a means model is required but not supplied.

So we decided to implement the following change:

1. Remove the automatic creation of a means matrix M when the means= argument is encountered in mxData. Instead, the means matrix M will be created only when a means model mxPath is specified. Thus, if you want to have means fixed to zero, you will need to specify that. This behavior is what already is in effect for type="raw". Scripts that previously relied on automatic generation of a saturated means model will now throw an error.

mspiegel's picture
Joined: 07/31/2009
Some minor comments to

Some minor comments to Steve's post. The changes he talked about will be in OpenMx 0.3.2, coming out 5/22-23/2010. Also, to reproduce the earlier behavior of OpenMx, you can use the following function:

createMeansPaths <- function(model) {
&nbsp;&nbsp;if (length(model@manifestVars) > 0) {
&nbsp;&nbsp;&nbsp;&nbsp;model <- mxModel(model, 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mxPath(from = "one", to = model@manifestVars, 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;free = TRUE, values = 0))
&nbsp;&nbsp;if (length(model@latentVars) > 0) {
&nbsp;&nbsp;&nbsp;&nbsp;model <- mxModel(model, 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mxPath(from = "one", to = model@latentVars, 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;free = FALSE, values = 0))