2

我想为使用semPlotSEM 模型的不同节点设置不同的大小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给出:

semPaths(fit, whatLabels="std", style="lisrel", exoCov = T, curvePivot = TRUE, sizeMan = 3, sizeInt = 5, 
     residuals=F) 

在此处输入图像描述

但是,我想要这样:在此处输入图像描述

4

1 回答 1

2

我为我的论文做了这个

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

于 2017-06-17T17:14:13.160 回答