path.diagram {sem} | R Documentation |
path.diagram
creates a description of the path diagram
for a structural-equation-model object to be processed by the
graph-drawing program dot; see Koutsofios and North (2002)
and http://www.graphviz.org/.
path.diagram(model, ...) ## S3 method for class 'sem': path.diagram(model, out.file, min.rank=NULL, max.rank=NULL, same.rank=NULL, variables=model$var.names, parameters=rownames(model$ram), ignore.double=TRUE, edge.labels=c("names", "values"), size=c(8, 8), node.font=c("Helvetica", 14), edge.font=c("Helvetica", 10), rank.direction=c("LR", "TB"), digits=2, ...)
model |
a structural-equation-model object produced by sem . |
... |
arguments to be passed down to path.diagram.sem . |
out.file |
a file to which to write the dot description of the path diagram; if not specified, the description is written to standard output (normally the R Console). |
min.rank |
a character string listing names of variables to be assigned minimum rank (order) in the graph; the names should be separated by commas. |
max.rank |
a character string listing names of variables to be assigned maximum rank in the graph; the names should be separated by commas. |
same.rank |
a character string or vector of character strings of variables to be assigned equivalent rank in the graph; names in each string should be separated by commas. |
variables |
variable names; defaults to the variable names in model .
If specified, the variable names should be in the same order as in model . |
parameters |
parameter names; defaults to the parameter names in
model . If specified, the parameter names should be in the same order
as in model . |
ignore.double |
if TRUE , the default, double-headed arrows, representing
variances and covariances, are not graphed. |
edge.labels |
"names" to label arrows with parameter names;
"values" to label arrows with parameter estimates. |
size |
the size of the graph, in inches. |
node.font |
font name and point-size for printing variable names. |
edge.font |
font name and point-size for printing arrow names or values. |
rank.direction |
draw graph left-to-right, "LR" , the default,
or top-to-bottom, "TB" . |
digits |
number of digits after the decimal point (default, 2) to which to round parameter estimates. |
NULL
: path.diagram
is used for its side-effect, producing a
graph description of the model.
John Fox jfox@mcmaster.ca
Koutsofios, E., and North, S. C. (2002) Drawing graphs with dot. http://www.graphviz.org/Documentation/dotguide.pdf.
# The Duncan, Haller, and Portes Peer-Influences Model R.DHP <- matrix(c( 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, .6247, 1, 0, 0, 0, 0, 0, 0, 0, 0, .3269, .3669, 1, 0, 0, 0, 0, 0, 0, 0, .4216, .3275, .6404, 1, 0, 0, 0, 0, 0, 0, .2137, .2742, .1124, .0839, 1, 0, 0, 0, 0, 0, .4105, .4043, .2903, .2598, .1839, 1, 0, 0, 0, 0, .3240, .4047, .3054, .2786, .0489, .2220, 1, 0, 0, 0, .2930, .2407, .4105, .3607, .0186, .1861, .2707, 1, 0, 0, .2995, .2863, .5191, .5007, .0782, .3355, .2302, .2950, 1, 0, .0760, .0702, .2784, .1988, .1147, .1021, .0931, -.0438, .2087, 1 ), ncol=10, byrow=TRUE) model.dhp <- matrix(c( 'RParAsp -> RGenAsp', 'gam11', NA, 'RIQ -> RGenAsp', 'gam12', NA, 'RSES -> RGenAsp', 'gam13', NA, 'FSES -> RGenAsp', 'gam14', NA, 'RSES -> FGenAsp', 'gam23', NA, 'FSES -> FGenAsp', 'gam24', NA, 'FIQ -> FGenAsp', 'gam25', NA, 'FParAsp -> FGenAsp', 'gam26', NA, 'FGenAsp -> RGenAsp', 'beta12', NA, 'RGenAsp -> FGenAsp', 'beta21', NA, 'RGenAsp -> ROccAsp', NA, 1, 'RGenAsp -> REdAsp', 'lam21', NA, 'FGenAsp -> FOccAsp', NA, 1, 'FGenAsp -> FEdAsp', 'lam42', NA, 'RGenAsp <-> RGenAsp', 'ps11', NA, 'FGenAsp <-> FGenAsp', 'ps22', NA, 'RGenAsp <-> FGenAsp', 'ps12', NA, 'ROccAsp <-> ROccAsp', 'theta1', NA, 'REdAsp <-> REdAsp', 'theta2', NA, 'FOccAsp <-> FOccAsp', 'theta3', NA, 'FEdAsp <-> FEdAsp', 'theta4', NA), ncol=3, byrow=TRUE) rownames(R.DHP) <- colnames(R.DHP) <- c('ROccAsp', 'REdAsp', 'FOccAsp', 'FEdAsp', 'RParAsp', 'RIQ', 'RSES', 'FSES', 'FIQ', 'FParAsp') sem.dhp <- sem(model.dhp, R.DHP, 329, fixed.x=c('RParAsp', 'RIQ', 'RSES', 'FSES', 'FIQ', 'FParAsp')) path.diagram(sem.dhp, min.rank='RIQ, RSES, RParAsp, FParAsp, FSES, FIQ', max.rank='ROccAsp, REdAsp, FEdAsp, FOccAsp') ## digraph "sem.dhp" { ## rankdir=LR; ## size="8,8"; ## node [fontname="Helvetica" fontsize=14 shape=box]; ## edge [fontname="Helvetica" fontsize=10]; ## center=1; ## {rank=min "RIQ" "RSES" "RParAsp" "FParAsp" "FSES" "FIQ"} ## {rank=max "ROccAsp" "REdAsp" "FEdAsp" "FOccAsp"} ## "RGenAsp" [shape=ellipse] ## "FGenAsp" [shape=ellipse] ## "RParAsp" -> "RGenAsp" [label="gam11"]; ## "RIQ" -> "RGenAsp" [label="gam12"]; ## "RSES" -> "RGenAsp" [label="gam13"]; ## "FSES" -> "RGenAsp" [label="gam14"]; ## "RSES" -> "FGenAsp" [label="gam23"]; ## "FSES" -> "FGenAsp" [label="gam24"]; ## "FIQ" -> "FGenAsp" [label="gam25"]; ## "FParAsp" -> "FGenAsp" [label="gam26"]; ## "FGenAsp" -> "RGenAsp" [label="beta12"]; ## "RGenAsp" -> "FGenAsp" [label="beta21"]; ## "RGenAsp" -> "ROccAsp" [label=""]; ## "RGenAsp" -> "REdAsp" [label="lam21"]; ## "FGenAsp" -> "FOccAsp" [label=""]; ## "FGenAsp" -> "FEdAsp" [label="lam42"]; ## }