plot.psem uses [DiagrammeR] to generate path diagrams of `piecewiseSEM`` fits within R.

# S3 method for psem
plot(
  x,
  return = FALSE,
  node_attrs = data.frame(shape = "rectangle", color = "black", fillcolor = "white"),
  edge_attrs = data.frame(style = "solid", color = "black"),
  ns_dashed = T,
  alpha = 0.05,
  show = "std",
  digits = 3,
  add_edge_label_spaces = TRUE,
  ...
)

Arguments

x

a [psem()] object

return

whether to return the output from [DiagrammeR::create_graph()] for modification and later plotting

node_attrs

List of node attributes to override defaults of rectangular nodes with black outline and white fill. See [here](http://visualizers.co/diagrammer/articles/node-edge-data-frames.html) and [here](http://visualizers.co/diagrammer/articles/graphviz-mermaid.html) for a more complete rundown of options.

edge_attrs

List of edge attributes to override defaults of solid black arrows. See [here](http://visualizers.co/diagrammer/articles/node-edge-data-frames.html) and [here](http://visualizers.co/diagrammer/articles/graphviz-mermaid.html) for a more complete rundown of options.

ns_dashed

If TRUE, paths that are not different from 0 will be dashed rather than solid, unless the whole is overridden in `edge_attrs`

alpha

The alpha level for assessing whether a path is different from 0

show

What types of path coefficients are shown? Default `"std"` is standardized coefficients. For undstandardized, use `"unstd"`

digits

How many significant digits should be shown?

add_edge_label_spaces

Should spaces by added on either side of edge labels? Default is `TRUE` as otherwise paths too often overlap edges.

...

Other arguments to [DiagrammeR::render_graph()]

Value

Returns an object of class [DiagrammeR::dgr_graph]

Author

Jarrett Byrnes <jarrett.byrnes@umb.edu>

Examples

data(keeley)

mod <- psem(
  lm(rich ~ cover, data=keeley),
  lm(cover ~ firesev, data=keeley),
  lm(firesev ~ age, data=keeley),
  data = keeley
)

plot(mod)
### More customized plot plot(mod, node_attrs = list( shape = "rectangle", color = "black", fillcolor = "orange", x = 3, y=1:4))