umx (version 4.0.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. Note: DiagrammeR is supported out of the box. By default, plots open in your browser.

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 = TRUE,
  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

If you use umx_set_plot_format("graphviz"), they 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

Other umx S3 functions: plot.MxLISRELModel()

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

Examples

Run this code
# NOT RUN {
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("intercept","slope")),
	umxPath("intercept", with = "slope"),
	umxPath("intercept", to = manifests, fixedAt = 1), 
	umxPath("slope", to = manifests, arrows = 1, fixedAt = c(0, 1, 2, 3, 4))
)

plot(m1, means=FALSE, std=TRUE, strip=TRUE, splines="FALSE", max="intercept")
# }
# NOT RUN {
 # end dontrun

# }

Run the code above in your browser using DataCamp Workspace