SEM diagrams

9 replies [Last post]
mspiegel's picture
Offline
Joined: 07/31/2009

The omxGraphviz() function in OpenMx currently draws arrows by inspecting the A and S matrices and looking for values that are non-zero. Is that the correct criteria, or should it be (value != 0 || free == TRUE)? On a related note, what is the correct criteria for drawing arrows from the M matrix? Is it (value != 0) or (value != 0 || free == TRUE)?

Steve's picture
Offline
Joined: 07/30/2009
(value != 0 || free == TRUE

(value != 0 || free == TRUE || !is.na(label)) is probably the right rubric for both.

mspiegel's picture
Offline
Joined: 07/31/2009
Done.

Done.

tbates's picture
Offline
Joined: 07/31/2009
Nifty. I guess these errors

Nifty. I guess these errors are due to omnigraffle.

given the values have to be accessed to build the dot file, can they be included on the paths?

Looks like matrixToPaths(fit[['S']],2) would want to be modified to include the value it finds in the path output.

Then they can be placed into the dot write-out.

digraph "univSat1" {
node [style=filled, fontname="Arial", fontsize=16]
X [shape=box, fillcolor="#a9fab1", height=0.5, width=0.5];
one [shape=triangle];
X -> X[dir=both, headport=s, tailport=s, label="0.98"];
one -> X[dir=forward, label="0.02"];
}

Steve's picture
Offline
Joined: 07/30/2009
Triangles are, in most path

Triangles are, in most path diagrams, flipped so that they point up.

tbates's picture
Offline
Joined: 07/31/2009
ahh, it's not omnigraffles

ahh, it's not omnigraffles error: should be

one [shape=invtriangle];

or
one [shape=polygon, sides=3, orientation=90];

mspiegel's picture
Offline
Joined: 07/31/2009
Umm, what? Triangles point

Umm, what? Triangles point up, invtriangles point down: http://www.graphviz.org/doc/info/shapes.html

tbates's picture
Offline
Joined: 07/31/2009
That's wierd: An inv triangle

That's wierd: An inv triangle comes out looking 'correct' in omnigraffle.
I can sort of see how: Omnigraffle's default triangle points down but still....

I've sent them a bug report.

tbates's picture
Offline
Joined: 07/31/2009
And they're on the case >

And they're on the case
> Thanks for the clear report; I’ve filed bug #56601 on
> this, based upon your report. I'm sorry for any
> inconvenience this is causing.

tbates's picture
Offline
Joined: 07/31/2009
yes, that seems the rule

yes, that seems the rule "draw everything that is free, labeled, or != 0"

Hopefully some users invest in this function as there are a bunch of things one could see it being extended to handle:

Adding the path value to paths is number 1,

I guess too if paths are equated (label == label) that would be good thing to capture in the dot, with an = sign on the path or similar.

When confidence intervals come along, you could show non-significant paths with a dotted style.

Perhaps identify paths as fixed or free - adding a black dot to the path, like a tack, fixing it down.