You are here

omxGraphviz(fit1,"test.dot") Error in path$from : $ operator not defined for this S4 class >

omxGraphviz is returning an error as in the title of this report...

demo

require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G1")
model1 <- 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=F, values=1.0),
mxData(cov(demoOneFactor), type="cov",numObs=500)
)
fit1 = mxRun(model1)
omxGraphviz(fit1,"test.dot")

Reporter: 
Created: 
Thu, 04/22/2010 - 07:58
Updated: 
Fri, 05/07/2010 - 11:02

Comments

Oops. I changed the representation of MxPath objects from lists() to S4 objects, and forgot to update omxGraphviz(). I've checked in a fix to the subversion repository. Can you confirm that the output is correct? I'll add a test case to models/passing that runs a diff on expected output versus against observed output file to ensure correctness.

thanks michael! - running now

looks to me in this code, that the line commented as "# G1<->G2" below is:
a. suppressing drawing the G1<->G1 and G2<->G2 variance loops
and
b. being drawn twice?

> model3 <- mxModel("Corr 2 Factor", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents[1], to=manifests[1:3]),
mxPath(from=latents[2], to=manifests[4:5]),
mxPath(from=manifests, arrows=2),
mxPath(from=latents,arrows=2, free=F, values=1.0),
mxPath(from=latents[1], to=latents[2], arrows=2, free=T, values=.1), # G1<->G2
mxData(cov(demoOneFactor), type="cov",numObs=500)
)
fit3 = mxRun(model3)
omxGraphviz(fit2)

Huh? When I run the example (assuming that latents <- c("G1", "G2") and I'm running fit3 instead of fit2), the relevant output is:

  G1 -> G1[dir=both, headport=n, tailport=n];
     G1 -> G2[dir=both];
     G2 -> G1[dir=both];
     G2 -> G2[dir=both, headport=n, tailport=n];

which is what was specified by the model.

hi mike - thanks for picking up the typos...

My brain-bug, then, is that I don't understand why this line:

mxPath(from=latents[1], to=latents[2], arrows=2, free=T, values=.1), # G1<->G2

generates two double-headed paths
G1 -> G2[dir=both];
G2 -> G1[dir=both];

I would have thought that it generated just one 2-headed path:
G1 ->G2[dir=both]

Fiddlesticks. Sorry I had ANOTHER bug where I was generating each symmetric path twice. Try it again with the latest version from subversion.

Ahh. that bug was worth it to hear "fiddle sticks" :-)
Cheers,
rumplestiltskin

Automatically closed -- issue fixed for 2 weeks with no activity.