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

plot.MxModelR Documentation

Create and display a graphical path diagram for a model.

Description

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

Usage

## S3 method for class '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 OpenMx::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::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(), umx, umxPlot(), umxPlotACE(), umxPlotACEcov(), umxPlotACEv(), umxPlotCP(), umxPlotDoC(), umxPlotFun(), umxPlotGxE(), umxPlotGxEbiv(), umxPlotIP(), umxPlotSexLim(), umxPlotSimplex()

Examples

## 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("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(Not run) # end dontrun


tbates/umx documentation built on Dec. 14, 2024, 11:28 a.m.