Problem getting parameters from model

9 replies [Last post]
fife's picture
Joined: 07/01/2010

Hi all,

I hope I'm just not seeing something, but the way you extract coefficients and fit statistics seems to have changed. It used to be that I could extract the coefficients by typing:


Now, that doesn't work. Normally, I might gripe mentally a bit about learning the new syntax, but I've written an entire package that relies on this functionality within OpenMX. It would probably take hours to find and debug all the error messages. So, is there a way to use the old way of extracting information from an MX model (Outside of downgrading my version of openmx)? Or am I just making things up? If things really have changed, will they probably be changing again?

fife's picture
Joined: 07/01/2010
I was wrong!!! I just worked it out with Michael outside of the site. The problem was on my end: I was taking an mx object, then giving it a totally different class, then trying to use it as if it retained the OpenMx class. SO, totally my fault. Thanks for the help!

tbates's picture
Joined: 07/31/2009

> OS X 10.9.4, R 3.0.3, OpenMx_1.4-3059. Here's the error I get:

So this is with 1.4, not the 2.0 beta?

> Error in summary(user.model)$parameters :
> $ operator is invalid for atomic vectors

mhunter's picture
Joined: 07/31/2009
Everything should still work

The code you wrote should still work. Running the frontpage model gives me the following:

> require(OpenMx)
Loading required package: OpenMx
Loading required package: digest
Loading required package: MASS
OpenMx is not compiled to take advantage of computers with multiple cores.
> data(demoOneFactor)
> manifests <- names(demoOneFactor)
> latents <- c("G")
> factorModel <- mxModel("One Factor",
+       type="RAM",
+       manifestVars = manifests,
+       latentVars = latents,
+       mxPath(from=latents, to=manifests),
+       mxPath(from=manifests, arrows=2),
+       mxPath(from=latents, arrows=2,
+             free=FALSE, values=1.0),
+       mxData(cov(demoOneFactor), type="cov",
+             numObs=500))
> summary(mxRun(factorModel))$parameters
Running One Factor 
                name matrix row col   Estimate   Std.Error lbound ubound
1  One Factor.A[1,6]      A  x1   G 0.39715214 0.015549740     NA     NA
2  One Factor.A[2,6]      A  x2   G 0.50366113 0.018232468     NA     NA
3  One Factor.A[3,6]      A  x3   G 0.57724141 0.020448361     NA     NA
4  One Factor.A[4,6]      A  x4   G 0.70277363 0.024011355     NA     NA
5  One Factor.A[5,6]      A  x5   G 0.79625002 0.026669401     NA     NA
6  One Factor.S[1,1]      S  x1  x1 0.04081419 0.002812718     NA     NA
7  One Factor.S[2,2]      S  x2  x2 0.03801999 0.002805794     NA     NA
8  One Factor.S[3,3]      S  x3  x3 0.04082719 0.003152310     NA     NA
9  One Factor.S[4,4]      S  x4  x4 0.03938706 0.003408875     NA     NA
10 One Factor.S[5,5]      S  x5  x5 0.03628710 0.003678562     NA     NA
   lboundMet uboundMet
1      FALSE     FALSE
2      FALSE     FALSE
3      FALSE     FALSE
4      FALSE     FALSE
5      FALSE     FALSE
6      FALSE     FALSE
7      FALSE     FALSE
8      FALSE     FALSE
9      FALSE     FALSE
10     FALSE     FALSE

What problem are you encountering with what OS, version of R, and version of OpenMx?

fife's picture
Joined: 07/01/2010
OS X 10.9.4, R 3.0.3,

OS X 10.9.4, R 3.0.3, OpenMx_1.4-3059. Here's the error I get:

Error in summary(user.model)$parameters :
$ operator is invalid for atomic vectors

tbates's picture
Joined: 07/31/2009
download OpenMx from the website

OpenMx 1.4.3475 (the website version), with R 3.1.0, it's working fine for me on Mac 10.9.4


mhunter's picture
Joined: 07/31/2009
You've got options

Let me first say I'm sorry you're encountering that problem. It is NOT one of the changes we've made to OpenMx. That functionality should continue to work.

As far as the bug, I think it's an interaction between new R (> 3.0), old OpenMx (< 2.0), and Mac. When I install OpenMx 1.4 on R 2.14, 3.0, and 3.1 using Windows it works fine. I can't replicate your error.

You have several options for resolving this issue.

Option 1
Try the Beta. Everything that works in 1.4 should work with the 2.0 beta. You might get a warning here or there, but nothing major.


Also, there are lots more cool features in the Beta that are not in 1.4. Changes in the Beta will become part of the stable release sooner or later. If you encounter a problem with the Beta, post on the forums so we know there's a problem and we can fix it quickly.

Option 2
Use the extractor function for parameters. This gets the parameters from a model, no standard errors though.


It should be a simple "find and replace" in your code if you choose this route.

Option 3
Downgrade R to something < 3.0.

Option 4
Wait for the Dev team to find and fix the bug in OpenMx 1.4 with R > 3.0 on Mac. I don't like this option, but it's out there.

Let us know which option you pick. HTH!

fife's picture
Joined: 07/01/2010
Looks like I'll have to find

Looks like I'll have to find and replace....updating didn't work. Alas! Thanks for the help.

tbates's picture
Joined: 07/31/2009

What do you see if you say


This might help us understand what was going wrong in the source version of 1.4 that you had installed.

As Mike Hunter says, this functionality will be supported, so there's no need for you to do find and replace changes at this stage, if you can get on a supported version that is working for you.

To get back and running now, ensure you are running either
1. The supported version of OpenMx 1.4 (minor release 3475, not the source-based version 3059 that you had)
2. Beta 2.0

They should both be working on R 3 and 3.1.

For others reading this thread, either of these give the version


If you can replicate the bug in either of these active versions, please do let us know...

In terms of parameter values, one 2.0 feature you might enjoy is the new mxStandardizeRAMpaths() function.

This returns SEs which are superior, and gives separate standardized values for paths which are equated.

That is worth doing some work to include.

Sorry for the hassles.

mhunter's picture
Joined: 07/31/2009
Which didn't work?

Which didn't work, updating R to 3.1 or updating OpenMx to the Beta? It's worth reiterating, summary(model)$parameters should work in OpenMx 1.4. It's a bug that makes it fail for you. It should also continue to work in newer versions of OpenMx. It has not been deprecated.