2

我已经成功地使用 R 的 Lavaan 包中的 growth() 函数对一项研究的纵向数据进行了建模。我在任何地方都找不到关于如何为每个参与者提取预测轨迹的文档。我只能找到整个组的预测轨迹(在摘要输出的“截距”部分下给出)。

4

1 回答 1

2

使用 lavPredict

model.syntax <- '
# intercept and slope with fixed coefficients
i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4

# regressions
i ~ x1 + x2
s ~ x1 + x2

# time-varying covariates
t1 ~ c1
t2 ~ c2
t3 ~ c3
t4 ~ c4
'

fit <- growth(model.syntax, data=Demo.growth)
summary(fit)

head(lavPredict(fit))

这将为每个人生成预测估计值

              i            s
[1,]  1.1378809  0.676301228
[2,] -2.5421940 -1.425974525
[3,] -0.1279434  0.966734762
[4,]  1.1682777  1.477200679
[5,] -0.5141435  0.006995809
[6,] -1.2646865  0.524024630
于 2016-07-19T23:33:36.937 回答