cjvanlissa / tidySEM

55 stars 7 forks source link

miss-matched defaults from `graph_sem` and `get_edges` #6

Closed mattansb closed 3 years ago

mattansb commented 4 years ago

graph_sem() seems to plot the unstandardized parameter, while get_edges() gets the standerdized parameters.

So we get:

library(lavaan)
#> This is lavaan 0.6-6
#> lavaan is BETA software! Please report any bugs.
library(tidySEM)

res <- sem("dist ~ speed", cars)

graph_sem(res)


graph_sem(res, edges = get_edges(res))

Created on 2020-07-03 by the reprex package (v0.3.0)

Which seems like an odd behavior.

I'd expect:

  1. get_edges() to return various values (est, est_sig, std, std_sig, sig... or something like that)
  2. graph_sem() to have a label_edge argument to choose the labels of the edges from the result of get_edges().

I guess this would need a complimentary label_node argument to choose the labels of the nodes from the result of get_nodes(). (Instead of label, which is documented as controlling the label of the nodes, but actually seems to control the labels of the edges?)

mattansb commented 3 years ago

This is resolved with the latest update - thanks!

library(lavaan)
#> This is lavaan 0.6-7
#> lavaan is BETA software! Please report any bugs.
library(tidySEM)

res <- sem("dist ~ speed", cars)

graph_sem(res)

graph_sem(res, edges = get_edges(res))


graph_sem(res, label = "est_sig_std")

graph_sem(res, edges = get_edges(res, label = "est_sig_std"))

Created on 2020-10-14 by the reprex package (v0.3.0)

cjvanlissa commented 3 years ago

@mattansb thank you for debugging this, it was very helpful!

mattansb commented 3 years ago

@cjvanlissa I will be using this for teaching in the spring semester - great stuff! Thanks!