plot.psem: Plotting of Piecewise Structural Equation Models

Description Usage Arguments Value Author(s) Examples

View source: R/plot_psem.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## S3 method for class '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(s)

Jarrett Byrnes <jarrett.byrnes@umb.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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))
  

Example output

Registered S3 methods overwritten by 'lme4':
  method                          from
  cooks.distance.influence.merMod car 
  influence.merMod                car 
  dfbeta.influence.merMod         car 
  dfbetas.influence.merMod        car 

  This is piecewiseSEM version 2.1.0.


  Questions or bugs can be addressed to <LefcheckJ@si.edu>.

piecewiseSEM documentation built on Jan. 13, 2021, 6:46 a.m.