diagram {psych} | R Documentation |

Path models are used to describe structural equation models or cluster analytic output. These functions provide the primitives for drawing path models. Used as a substitute for some of the functionality of Rgraphviz.

diagram(fit,...) dia.rect(x, y = NULL, labels = NULL, cex = 1, xlim = c(0, 1), ylim = c(0, 1), ...) dia.ellipse(x, y = NULL, labels = NULL, cex=1,e.size=.05, xlim=c(0,1), ylim=c(0,1), ...) dia.triangle(x, y = NULL, labels =NULL, cex = 1, xlim=c(0,1),ylim=c(0,1),...) dia.ellipse1(x,y,e.size=.05,xlim=c(0,1),ylim=c(0,1),...) dia.shape(x, y = NULL, labels = NULL, cex = 1, e.size=.05, xlim=c(0,1), ylim=c(0,1), shape=1, ...) dia.arrow(from,to,labels=NULL,scale=1,cex=1,...) dia.curve(from,to,labels=NULL,scale=1,...) dia.curved.arrow(from,to,labels=NULL,scale=1,...) dia.self(location,labels=NULL,scale=.8,side=2,...) dia.cone(x=0, y=-2, theta=45, arrow=TRUE,curves=TRUE,add=FALSE,labels=NULL, xlim = c(-1, 1), ylim=c(-1,1),... )

`fit` |
The results from a factor analysis |

`x` |
x coordinate of a rectangle or ellipse |

`y` |
y coordinate of a rectangle or ellipse |

`e.size` |
The size of the ellipse (scaled by the number of variables |

`labels` |
Text to insert in rectangle, ellipse, or arrow |

`cex` |
adjust the text size |

`scale` |
modifies size of rectangle and ellipse as well as the curvature of curves. (For curvature, positive numbers are concave down and to the left |

`from` |
arrows and curves go from |

`to` |
arrows and curves go to |

`location` |
where is the rectangle? |

`shape` |
Which shape to draw |

`xlim` |
default ranges |

`ylim` |
default ranges |

`side` |
Which side of boxes should errors appear |

`theta` |
Angle in degrees of vectors |

`arrow` |
draw arrows for edges in dia.cone |

`add` |
if TRUE, plot on previous plot |

`curves` |
if TRUE, draw curves between arrows in dia.cone |

`...` |
Most graphic parameters may be passed here |

The diagram function calls `fa.diagram`

, `omega.diagram`

, `ICLUST.diagram`

or `lavaan.diagram`

depending upon the class of the fit input. See those functions for particular parameter values.

The remaining functions are the graphic primitives used by `fa.diagram`

, `structure.diagram`

, `omega.diagram`

, and `ICLUST.diagram`

.

They create rectangles, ellipses or triangles surrounding text, connect them to straight or curved arrows, and can draw an arrow from and to the same rectangle.

Each shape (ellipse, rectangle or triangle) has a left, right, top and bottom and center coordinate that may be used to connect the arrows.

Curves are double-headed arrows.

The helper functions were developed to get around the infelicities associated with trying to install Rgraphviz and graphviz.

Better documentation will be added as these functions get improved. Currently the helper functions are just a work around for Rgraphviz.

dia.cone draws a cone with (optionally) arrows as sides and centers to show the problem of factor indeterminacy.

Graphic output

William Revelle

The diagram functions that use the dia functions: `fa.diagram`

, `structure.diagram`

, `omega.diagram`

, and `ICLUST.diagram`

.

#first, show the primitives xlim=c(-2,10) ylim=c(0,10) plot(NA,xlim=xlim,ylim=ylim,main="Demonstration of diagram functions",axes=FALSE,xlab="",ylab="") ul <- dia.rect(1,9,labels="upper left",xlim=xlim,ylim=ylim) ml <- dia.rect(1,6,"middle left",xlim=xlim,ylim=ylim) ll <- dia.rect(1,3,labels="lower left",xlim=xlim,ylim=ylim) bl <- dia.rect(1,1,"bottom left",xlim=xlim,ylim=ylim) lr <- dia.ellipse(7,3,"lower right",xlim=xlim,ylim=ylim,e.size=.07) ur <- dia.ellipse(7,9,"upper right",xlim=xlim,ylim=ylim,e.size=.07) mr <- dia.ellipse(7,6,"middle right",xlim=xlim,ylim=ylim,e.size=.07) lm <- dia.triangle(4,1,"Lower Middle",xlim=xlim,ylim=ylim) br <- dia.rect(9,1,"bottom right",xlim=xlim,ylim=ylim) dia.curve(from=ul$left,to=bl$left,"double headed",scale=-1) dia.arrow(from=lr,to=ul,labels="right to left") dia.arrow(from=ul,to=ur,labels="left to right") dia.curved.arrow(from=lr,to=ll,labels ="right to left") dia.curved.arrow(to=ur,from=ul,labels ="left to right") dia.curve(ll$top,ul$bottom,"right") #for rectangles, specify where to point dia.curve(ll$top,ul$bottom,"left",scale=-1) #for rectangles, specify where to point dia.curve(mr,ur,"up") #but for ellipses, you may just point to it. dia.curve(mr,lr,"down") dia.curve(mr,ur,"up") dia.curved.arrow(mr,ur,"up") #but for ellipses, you may just point to it. dia.curved.arrow(mr,lr,"down") #but for ellipses, you may just point to it. dia.curved.arrow(ur$right,mr$right,"3") dia.curve(ml,mr,"across") dia.curve(ur,lr,"top down") dia.curved.arrow(br$top,lr$bottom,"up") dia.curved.arrow(bl,br,"left to right") dia.curved.arrow(br,bl,"right to left",scale=-1) dia.arrow(bl,ll$bottom) dia.curved.arrow(ml,ll$right) dia.curved.arrow(mr,lr$top) #now, put them together in a factor analysis diagram v9 <- sim.hierarchical() f3 <- fa(v9,3,rotate="cluster") fa.diagram(f3,error=TRUE,side=3)

[Package *psych* version 1.4.5 Index]