semPaths()로 다이어그램 생성

R에서 lavaan으로 배우는 구조방정식모형

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)
R에서 lavaan으로 배우는 구조방정식모형

semPaths() 기본 출력

semPaths 기본 플롯

R에서 lavaan으로 배우는 구조방정식모형

그림 편집

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

엣지 레이블이 추가된 업데이트된 모델 그림

R에서 lavaan으로 배우는 구조방정식모형

그림 레이아웃

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

원형 옵션으로 레이아웃 업데이트

R에서 lavaan으로 배우는 구조방정식모형

그림 회전

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

잠재변수가 왼쪽에 위치한 트리 회전 업데이트

R에서 lavaan으로 배우는 구조방정식모형

색상 시각화

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

보라색 음영으로 색상 업데이트

R에서 lavaan으로 배우는 구조방정식모형

연습해 봅시다!

R에서 lavaan으로 배우는 구조방정식모형

Preparing Video For Download...