分析潛在變數中的 Heywood 個案
當地一家動物收容所設計了一份問卷,想評估他們的 Adopt Me 計畫的影響。觀看者會為每隻狗的照片、背景故事,以及其他特徵評分,用以表示每隻動物的「可被領養程度」。
adoptsurvey 資料包含他們評分的 6 個題項,其中 pictures、background、loveskids 用來衡量「good story」這個潛在變數,而 energy、wagstail、playful 用來衡量「in person」這個潛在變數。你將建立一個兩因子模型,並檢查是否出現 Heywood 個案。lavaan 函式庫已為你載入。
本練習屬於課程
在 R 中使用 lavaan 的結構方程模型
練習說明
goodstory潛在變數由pictures、background、loveskids所測量。inperson潛在變數由energy、wagstail、playful所測量。- 使用
cfa()函式分析這個兩因子模型。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Look at the data
head(adoptsurvey)
# Build the model
adopt.model <- 'goodstory ___
inperson ___'
# Analyze the model
adopt.fit <- cfa(model = ___, data = ___)