alishinski / lavaanPlot

R package for plotting lavaan path models with DiagrammeR
http://alexlishinski.com/lavaanPlot/
39 stars 4 forks source link

multiple group analysis #25

Open maxnormaal opened 4 years ago

maxnormaal commented 4 years ago

Hi,

I am conducting a multiple group analysis with lavaan. When plotting the coefs with lavaanPlot, I´m getting in trouble with having no labels (like "Group1"/"Group2") plotted to the paths of the coefs. Here is my code:

lavaanPlot(model = fit, coefs = TRUE, sig = 1, stars="regress", covs = TRUE)

So, my question is: How do I get lavaanPlot to plot some sort of label to the coefs, so that is possible to distinguish between the effects of group1/group2?

Thanks in advance! Adrian

alishinski commented 3 years ago

So the issue is that the paths in your diagram should have multiple values for group1 and group2 for different coefficient values?

jorgesinval commented 3 years ago

I would suggest something like this:

https://media.springernature.com/full/springer-static/image/art%3A10.1007%2Fs11482-019-09730-3/MediaObjects/11482_2019_9730_Fig1_HTML.png

maxnormaal commented 3 years ago

Well, I thought of something like a numeric indicator for the groups to make it easier to identify which group belongs to which path, like that: Rplot

jorgesinval commented 3 years ago

Yes, this would also be a good solution.

alishinski commented 3 years ago

When I'm able to get subgraphs implemented, you should be able to do conditional formatting to distinguish multiple groups. I don't know of a way where I could do secondary labels like that with diagrammeR.