gpt4 book ai didi

r - semPaths - lavaan SEM 的不同大小的节点

转载 作者:行者123 更新时间:2023-12-05 05:20:29 24 4
gpt4 key购买 nike

我想为带有 lavaan 的 SEM 模型使用 semPlot 为不同的节点设置不同的大小。

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)

enter image description here

但是,我想要这样:enter image description here

最佳答案

我为我的论文做了这个

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

关于r - semPaths - lavaan SEM 的不同大小的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44606103/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com