Revision of omxGraphviz help (making path diagrams) from Thu, 09/01/2011 - 12:41

The revisions let you track differences between multiple versions of a post.

Wiki home page

Table of Contents 

OpenMx can output path diagrams using the dot syntax.

You can learn about this language for describing path diagrams at several online tutorials.

The R for generating a path diagram from a model is straightforward:

	 omxGraphviz(model, dotFilename="")

(currently for RAM models only)

If you leave parameter 2 blank, the dot file will be output into the R console.

There's an example of usage here

Rendering the output

The output is just a linguistic description of the nodes and edges of your diagram - to visualise it, this must be processed by an application such as graphvis.

Other programmes that can read .dot include Omnigraffle.

This app does a nice job of rendering .dot http://www.graphviz.org/

This site http://ashitani.jp/gv/ has an online renderer, which is handy for cut and paste: Paste this in to see a sex lim model :-)

t1 [label="Pt1", shape=box]
t2 [label="Pt2", shape=box]

Af -> Am [dir=both, label="ag"]
Cf -> Cm [dir=both, label="eta"]

Af -> t1 [label="af"]
Cf -> t1 [label="cf"]
Ef -> t1 [label="ef"]

Am -> t2 [label="am"]
Cm -> t2 [label="cm"]
Em -> t2 [label="em"]

{rank=min; Af; Cf; Ef; Am; Cm; Em; }; {rank=max; t1; t2};

Comments

KimmoV's picture

tiny typo

The example on this page:
omxGraphviz(model, dotFileName="")
should be
omxGraphviz(model, dotFilename="")
(i.e., "Name" written as "name"), otherwise R does not understand it.
Cheers,
- Kimmo