I want to set different sizes for different nodes using semPlot
for a SEM model with lavaan
.
library(lavaan)
library(semPlot)
model <- '
# measurement model
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
'
fit <- sem(model, data=PoliticalDemocracy)
semPlot
gives:
semPaths(fit, whatLabels="std", style="lisrel", exoCov = T, curvePivot = TRUE, sizeMan = 3, sizeInt = 5,
residuals=F)
However, I would like this:
I did this for my thesis
semPaths(fit, style="lisrel",
whatLabels = "std", edge.label.cex = .6, node.label.cex = .6,
label.prop=0.9, edge.label.color = "black", rotation = 4,
equalizeManifests = FALSE, optimizeLatRes = TRUE, node.width = 1.5,
edge.width = 0.5, shapeMan = "rectangle", shapeLat = "ellipse",
shapeInt = "triangle", sizeMan = 4, sizeInt = 2, sizeLat = 4,
curve=2, unCol = "#070b8c")
Totally ugly but good result in the end !
The full SEM analysis is here https://github.com/pachamaltese/thesis
I also wrote a full tutorial in two parts for my blog: http://pacha.hk/tag/structural-equation-modelling-sem.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With