You are here

Error: in slot(model, name) : no slot of name ".forcesequential" for this object of class "MxModel"

9 posts / 0 new
Last post
adstaple's picture
Offline
Joined: 01/06/2010 - 19:29
Error: in slot(model, name) : no slot of name ".forcesequential" for this object of class "MxModel"

I previously ran analyses in OpenMx and saved the R workspace so that I could get the information at a later date.

The Error: in slot(model, name) :
no slot of name ".forcesequential" for this object of class "MxModel"

Occurs when I call
summary(mxModelFit)

On a Mac running 10.7.3, R v. 2.14.2, OpenMx v. 1.2.3-2011

However, when I use the same call (after loading the same R workspace file) on a different Mac running 10.7.3, R v. 2.14.0, OpenMx v. 1.1.2-1818, I do not get the error.

I originally ran the models on the Mac running the older versions of R and OpenMx. I'm not sure how to solve this error. Any suggestions?

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
The internal representation

The internal representation of models may change over time. The original OpenMx script will continue to work across different versions of the library. In order to view your older model, you could download an older version of OpenMx (from here) and install it on your machine.

In general, it is safer to keep a copy of the OpenMx script rather than keep a copy of the workspace. If your model takes a long time to run, then I would use checkpointing so that you can restart your model from the last checkpoint.

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
Angela stopped by my office

Angela stopped by my office to give me the rest of the details about this error. The main feature of this model is confidence interval calculation. It sounds like 'forcesequential' is a slot added when mxCI was parallelized, and summary is choking when it looks for this structure in her saved mxModel object. Anyone have any better ideas?

I'm not quite sure what to do about this. In this specific case, we could do some kind of work around in summary to deal with the missing slot. However, it might be simpler to write some type of version converter that takes models built under previous versions of OpenMx and adds whatever slots we've added with NULL or default values.

Generally, we probably don't want to add lots of conditional statements to the summary code to make it work with every previous version. We may want to add some support for these issues, as we have users who have written extremely complex models with long optimization times, and the checkpoint file doesn't contain all of the necessary information for summary reporting.

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
If you keep a copy of the

If you keep a copy of the OpenMx script, and you checkpoint every N minutes, then can't you just re-run the model from that most recent checkpoint (with mxRestore()) and it will take at most N minutes to finish? Is there something I'm missing?

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Use the command traceback()

Use the command traceback() when the error message appears and copy/paste that output into this forum. I think the summary() function doesn't use the .forcesequential slot, so I'm curious to determine what is happening. Another suggestion is to try the following and see if it makes the summary() function work.

slot(mxModelFit, ".forcesequential", check = FALSE) <- FALSE

adstaple's picture
Offline
Joined: 01/06/2010 - 19:29
Here are the results from

Here are the results from traceback()

15: slot(model, name)
14: .local(.Object, ...)
13: initialize(value, ...)
12: initialize(value, ...)
11: new("MxFlatModel", model, list(), list())
10: imxFlattenModel(model, namespace)
9: mxEval(eta00, model, compute, show)
8: eval(expr, envir, enclos)
7: eval(substitute(mxEval(x, model, compute, show), list(x = as.name(name))))
6: FUN(c("eta00", "eta01", "eta02", "eta03", "eta04", "eta05", "eta06",
"eta10", "eta11", "eta12", "eta13", "eta14", "eta15", "eta16",
"zeta")[[1L]], ...)
5: lapply(X = X, FUN = FUN, ...)
4: sapply(entities, imxEvalByName, model, compute = TRUE, show = FALSE)
3: generateConfidenceIntervalTable(model)
2: summary(genderEtaLDEFit)
1: summary(genderEtaLDEFit)

Attempting the work around you suggest, resulted in the following error:
> Error in slot(model, name) :
> no slot of name ".resetdata" for this object of class "MxModel"

with the corresponding traceback()
15: slot(model, name)
14: .local(.Object, ...)
13: initialize(value, ...)
12: initialize(value, ...)
11: new("MxFlatModel", model, list(), list())
10: imxFlattenModel(model, namespace)
9: mxEval(eta00, model, compute, show)
8: eval(expr, envir, enclos)
7: eval(substitute(mxEval(x, model, compute, show), list(x = as.name(name))))
6: FUN(c("eta00", "eta01", "eta02", "eta03", "eta04", "eta05", "eta06",
"eta10", "eta11", "eta12", "eta13", "eta14", "eta15", "eta16",
"zeta")[[1L]], ...)
5: lapply(X = X, FUN = FUN, ...)
4: sapply(entities, imxEvalByName, model, compute = TRUE, show = FALSE)
3: generateConfidenceIntervalTable(model)
2: summary(genderEtaLDEFit)
1: summary(genderEtaLDEFit)

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
For the missing slots in the

For the missing slots in the old model object, first determine what the default values are in the latest version of OpenMx. For example, if I want to find out what the default value for model@.resetdata, then I would do the following:

foo <- mxModel('foo')
defaultValue <- foo@.resetdata

Then use the previous technique of assigning the default value back to the old model object.
slot(mxModelFit, ".resetdata", check = FALSE) <- defaultValue

adstaple's picture
Offline
Joined: 01/06/2010 - 19:29
Determining the default in

Determining the default in the latest version of OpenMx works for

foo@.resetdata
> [1] FALSE

however, what do you suggest in the following situation

foo@.forcesequential
> logical(0)

Finally, if the default is already FALSE, how would reassigning the same value correct the problem? Or am I missing something?

----- update -----
Clearly I there is magic that I am missing because the following actually works:

slot(mxModelFit,".forcesequential",check=FALSE) <- FALSE
slot(mxModelFit,".resetdata",check=FALSE) <- FALSE
summary(mxModelFit)

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Oops. I forgot that

Oops. I forgot that model@.forcesequential is assigned a value only when the model is run (it looks like the model also needs an objective function to set the .forcesequential value). I suspect that the following may have worked as well, but maybe not:

slot(mxModelFit,".forcesequential",check=FALSE) <- logical(0)
slot(mxModelFit,".resetdata",check=FALSE) <- logical(0)
summary(mxModelFit)

As to why you need to assigning these values manually, it's because the model that you are loaded from the file had been created at a time when the slots '.forcesequential' and '.resetdata' did not exist. When the model is loaded into the R interpreter, it is missing those slots. We are manually injecting those slots back into the model. In the general case, there may have been some sort of useful information in the missing slots that is either difficult or impossible to recover. We got lucky in this particular instance.