Error in Slot

4 replies [Last post]
pgseye's picture
Offline
Joined: 10/13/2009

Hi,

Some scripts which I'm sure have run without problems a couple of months ago are now giving me the following error:

> equateAEModelFit <- mxRun(equateAEModel)
Running equateAE
Error in slot(model, name) :
no slot of name ".newobjects" for this object of class "MxModel"

Any ideas what's happening?

Thanks,

Paul

mspiegel's picture
Offline
Joined: 07/31/2009
Can you run the following and

Can you run the following and tell me what is stored in the variable 'slots'?

slotN <- slotNames(equateAEModel)

If you see ".newobjects", ".newobjective", and ".newtree" in the output above, then try:

slotN <- setdiff(slotN, c('.newobjects', '.newobjective', '.newtree'))

And then try:

newModel <- mxModel()
for(i in 1:length(slotN)) {
slot(newModel, slotN[[i]]) <- slot(equateAEModel, slotN[[i]])
}

pgseye's picture
Offline
Joined: 10/13/2009
That seems to work. Thanks a

That seems to work. Thanks a lot.

> slotN <- slotNames(equateAEModelFit)
> slotN
[1] "name" "matrices" "algebras" "constraints" "intervals" "latentVars"
[7] "manifestVars" "data" "submodels" "objective" "independent" "options"
[13] "output" "runstate" ".newobjects" ".newobjective" ".newtree"
> slotN <- setdiff(slotN, c('.newobjects', '.newobjective', '.newtree'))
> slotN
[1] "name" "matrices" "algebras" "constraints" "intervals" "latentVars" "manifestVars"
[8] "data" "submodels" "objective" "independent" "options" "output" "runstate"
> newModel <- mxModel()
> for(i in 1:length(slotN)) {
+ slot(newModel, slotN[[i]]) <- slot(equateAEModelFit, slotN[[i]])
+ }
> tableFitStatistics(multiCholACEFit, newModel)
Name ep -2LL df AIC diffLL diffdf p
Model 1 : multiCholACE 250 24309 12892 -1475 - - -
Model 2 : equateAE 172 24344.68 12982 -1619.32 35.68 90 1

mspiegel's picture
Offline
Joined: 07/31/2009
This solution should work:

This solution should work: http://openmx.psyc.virginia.edu/thread/774

pgseye's picture
Offline
Joined: 10/13/2009
Thanks Michael, But I don't

Thanks Michael,
But I don't follow this - sorry.
When I try to substitute using:

newModel <- mxModel()
oldSlotNames <- slotNames(equateAEModel)
for(i in 1:length(oldSlotNames)) {
slot(newModel, oldSlotNames[[i]]) <- slot(equateAEModel, oldSlotNames[[i]])
}

I get a similar error:
Error in slot(equateAEModel, oldSlotNames[[i]]) :
no slot of name ".newobjects" for this object of class "MxModel"

Can you explain what I need to?