Graphical representation of log-linear models
gipf , model(string) [, nolegend gap(int) order(string) nodelabel(string) lwidth(int) saving(twoway_saving option) ]
Description
This command takes a log-linear model and draws an undirected graph, the nodes are the variables in the model and edges between nodes represent a second order interaction or higher. The nodes are placed in a circle for ease of display so may look cluttered with large amounts of nodes. It's main benefit is when used in conjunction with the command swblock for displaying the inter-locus relationships in a small genomic region. The log-linear model should be specified by the syntax used in the commands hapipf or ipf.
Options
nolegend specifies that the legend for the edges is not displayed
gap(int) specifies that an "invisible node" is inserted at the top of the graph. This is handy when the variables in the log-linear model are ordered and the "end" variables need to moved further apart.
order(string) specifies the order of the nodes. The default is to order nodes around a circle in reverse alphabetical order.
nodelabel(string) specifies that the nodes are labelled with text rather than variable names.
lwidth(int) specifies the relative thickness of the edges. The default integer value is 1 and is best for looking at graphs within STATA. Integers greater than 1 will give thicker edges.
saving(twoway_saving option) specifies that the graph is saved to disk. This option takes the same syntax as the twoway saving_option.
Examples
If the log-linear model was A*B. Then you would have 2 nodes A and B. The "*" indicates that A and B interact or are related to each other and is represented by a straight line connecting the two nodes.
e.g. B ----- A
Click here gipf, model(A*B) gap(1) to see this graphic
The gap option means that an empty node is inserted at the top of the graph. Without the gap option the graph would become
B | | | | A
Click here gipf, m(A*B) to see this graphic.
As noticed from the above graphs the node B always appears to the left or upper section. To reverse the node labels then use the order option.
e.g. A ------ B
Click here gipf, m(A*B) order(B A) g(1) to see this graphic.
To label nodes differently to A and B you can assign labels by using the nodela > bel option
Click here gipf, m(A*B) o(B A) g(1) nodelabel("Var B" "Var A") to see this graphic. Note that the node labels are in the order B then A, this was specified by the order option.
For more complicated models there are usually more than 2 nodes for example the graph for A*B+A*C looks like
A / \ / \ / \ C B
Click here gipf, m(A*B+A*C) to get the above graph you need to reorder the nodes now click here gipf, m(A*B+A*C) o(B C A). Finally to add labels to this graph click here gipf, m(A*B+A*C) o(B C A) n("Var B" "Var C" "Var A")
The final example is much more complicated and has higher order interactions and this is much easier seen by clicking the last command
gipf, m(A*B*C*D+E*F*G+H*I+J)
Use with swblock
The command swblock is looking for the simplest model to describe a set of genetic loci haplotype frequencies. Here the inclusion p-value is set to be 0.01 and there are 4 genetic markers.
.swblock l10_1-l13_2, p(0.01)
After this command has been run the "best" model is in the return class macro called parsimod. Immediately after the above command the model can be displayed as the above log-linear model graph by the following command
.gipf, m(`r(parsimod)')
Author
Adrian Mander, Glaxo Smithkline, Harlow, UK. Email adrian.p.mander@gsk.com
Also see
Related commands
HELP FILES Installation status SSC installation links
hapipf (if installed) (ssc install hapipf) ipf (if installed) (ssc install ipf) hapblock (if installed) (ssc install hapblock) > swblock (if installed) (ssc install swblock).