Learn R Programming

umx (version 4.20.0)

plot.MxModel: Create and display a graphical path diagram for a model.

Description

plot() produces SEM diagrams in graphviz format, and relies on DiagrammeR() (or a graphviz application) to create the image.

Usage

# S3 method for MxModel
plot(
  x = NA,
  std = FALSE,
  fixed = TRUE,
  means = TRUE,
  digits = 2,
  file = "name",
  labels = c("none", "labels", "both"),
  resid = c("circle", "line", "none"),
  strip_zero = FALSE,
  splines = c("TRUE", "FALSE", "compound", "ortho", "polyline"),
  min = NULL,
  same = NULL,
  max = NULL,
  ...
)

Arguments

x

An mxModel() from which to make a path diagram

std

Whether to standardize the model (default = FALSE).

fixed

Whether to show fixed paths (defaults to TRUE)

means

Whether to show means or not (default = TRUE)

digits

The number of decimal places to add to the path coefficients

file

The name of the dot file to write: NA = none; "name" = use the name of the model

labels

Whether to show labels on the paths. "none", "labels", or "both" (parameter + label).

resid

How to show residuals and variances default is "circle". Options are "line" & "none"

strip_zero

Whether to strip the leading "0" and decimal point from parameter estimates (default = FALSE)

splines

Whether to allow lines to curve: defaults to "TRUE" (nb: some models look better with "FALSE")

min

optional list of objects to group at the top of the plot. Default (NULL) chooses automatically.

same

optional list of objects to group at the same rank in the plot. Default (NULL) chooses automatically.

max

optional list of objects to group at the bottom of the plot. Default (NULL) chooses automatically.

...

Optional parameters

Details

Note: DiagrammeR is supported out of the box. By default, plots open in your browser. Other options include pdf SVG etc.

If you use umx_set_plot_format("graphviz"), graphs will open in a graphviz helper app (if installed).

The commercial application “OmniGraffle” is great for editing these images. On unix and windows, plot() will create a pdf and open it in your default pdf reader.

If you use graphviz, we try and use that app, but YOU HAVE TO INSTALL IT!

MacOS note: On Mac, we will try and open an app: you may need to associate the ‘.gv’ extension with the graphviz app. Find the .gv file made by plot, get info (cmd-I), then choose “open with”, select graphviz.app (or OmniGraffle professional), then set “change all”.

References

See Also

  • umx_set_plot_format(), plot.MxModel(), umxPlotACE(), umxPlotCP(), umxPlotIP(), umxPlotGxE()

Other Plotting functions: ggAddR(), plot.MxLISRELModel(), plot.MxModelTwinMaker(), umxPlotACEcov(), umxPlotACEv(), umxPlotACE(), umxPlotCP(), umxPlotDoC(), umxPlotFun(), umxPlotGxEbiv(), umxPlotGxE(), umxPlotIP(), umxPlotSexLim(), umxPlotSimplex(), umxPlot(), umx

Examples

Run this code
if (FALSE) {
require(umx)
data(demoOneFactor)
manifests = names(demoOneFactor)
m1 = umxRAM("One Factor", data = demoOneFactor, type = "cov",
	umxPath("G", to = manifests),
	umxPath(var = manifests),
	umxPath(var = "G", fixedAt = 1)
)
plot(m1)
plot(m1, std = TRUE, resid = "line", digits = 3, strip_zero = FALSE)

# ============================================================
# = With a growth model, demonstrate splines= false to force =
# = straight lines, and move "rank" of intercept object      =
# ============================================================

m1 = umxRAM("grow", data = myGrowthMixtureData,
	umxPath(var = manifests, free = TRUE), 
	umxPath(means = manifests, fixedAt = 0), 
	umxPath(v.m. = c("int","slope")),
	umxPath("int", with = "slope"),
	umxPath("int", to = manifests, fixedAt = 1), 
	umxPath("slope", to = manifests, arrows = 1, fixedAt = c(0,1,2,3,4))
)

plot(m1, means=FALSE, strip=TRUE, splines="FALSE", max="int")
} # end dontrun

Run the code above in your browser using DataLab