我想使用semPlot
为lavaan
的SEM模型设置不同节点的不同大小。
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
给出:
semPaths(fit, whatLabels="std", style="lisrel", exoCov = T, curvePivot = TRUE, sizeMan = 3, sizeInt = 5,
residuals=F)
答案 0 :(得分:1)
我为我的论文做了这个
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")
最终完全丑陋但结果很好!
完整的SEM分析在https://github.com/pachamaltese/thesis
我还为我的博客分两部分写了一个完整的教程:http://pacha.hk/tag/structural-equation-modelling-sem.html