สร้างไดอะแกรมด้วย semPaths()

Structural Equation Modeling ด้วย lavaan ใน R

Erin Buchanan

Professor

semPlot และ semPaths()

library(lavaan)
library(semPlot)
twofactor.model <- 'text =~ x4 + x5 + x6
    speed =~ x7 + x8 + x9'
twofactor.fit <- cfa(model = twofactor.model, 
                     data = HolzingerSwineford1939)
semPaths(object = twofactor.fit)
Structural Equation Modeling ด้วย lavaan ใน R

ผลลัพธ์เริ่มต้นของ semPaths()

ผลลัพธ์เริ่มต้นจาก semPaths

Structural Equation Modeling ด้วย lavaan ใน R

แก้ไขภาพ

semPaths(object = twofactor.fit,
         whatLabels = "std", 
         edge.label.cex = 1)
#whatLabels can also be "par" 

ภาพโมเดลที่อัปเดตพร้อม Edge Labels

Structural Equation Modeling ด้วย lavaan ใน R

เลย์เอาต์ของภาพ

semPaths(object = twofactor.fit,
          whatLabels = "std", 
          edge.label.cex = 1, 
          layout = "circle")
#layout options are tree, circle, spring, tree2, circle2

เลย์เอาต์ที่อัปเดตเป็นแบบ Circle

Structural Equation Modeling ด้วย lavaan ใน R

การหมุนภาพ

semPaths(object = twofactor.fit,
          whatLabels = "std", 
          edge.label.cex = 1, 
          layout = "tree", rotation = 2)
#rotation options are 1, 2, 3, 4 for tree layouts

การหมุน Tree ที่อัปเดตโดยให้ Latents อยู่ทางซ้าย

Structural Equation Modeling ด้วย lavaan ใน R

การแสดงสี

semPaths(object = twofactor.fit,
         whatLabels = "std", 
         edge.label.cex = 1, 
         layout = "tree", rotation = 2,
         what = "std", edge.color = "purple")
#what options include par and std

อัปเดตสีเป็นโทนม่วง

Structural Equation Modeling ด้วย lavaan ใน R

มาฝึกกันเถอะ!

Structural Equation Modeling ด้วย lavaan ใน R

Preparing Video For Download...