简体   繁体   中英

In OpenMx 2, what does Error: no slot of name “objective” for this object of class “MxRAMModel” mean?

In OpenMx 1, we could access the objective with

model@objective

In OpenMx 2, this slot is missing (as the objective now distinguishes explicitly between the expectation and the fit function). So, I guess we should be accessing the objective with

model$expectation
model$fitfunction

Or

model@expectation
model@fitfunction

Is that right?

The 2.0 release note says:

  • Replacement of @ accessors with $ accessors in mxModel objects. You no longer have to keep track of when to use which; just always use $!

NOTE: Concerning the last bullet point, users should definitely get into the habit of ALWAYS using $ instead of @. For example, myModelRun@output$estimate would now be myModelRun$output$estimate. We CANNOT guarantee that every usage of the @ accessor that worked with versions 1.3/1.4 will continue to work in 2.0.

http://openmx.psyc.virginia.edu/2014/05/first-openmx-20-beta-released

Yes: in OpenMx 2 the correct thing to do is model$fitfunction and model$expectation

In general, in OpenMx 2, avoid using @ to access any part of a model: Use $ instead. Helpfully, OpenMx 2 also enables tab-completion for easy discovery of model components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM