双域潜在增长曲线的选项可能在熔岩中?

问题描述

我正在尝试分析两个结果变量的三个重复测量值。建议使用潜在增长曲线模型。我知道在某些软件 (SPSS) 中,您可以使用多种度量来制作增长曲线,但在 lavaan 中似乎并不那么简单。阅读 lavaan 教程,它提到了使用 sem() 的多级 SEM - 这是否适用于重复测量数据集?或者是否有另一个包允许 R 中的多个结果增长曲线?

解决方法

要在 lavaan 内创建潜在增长曲线很容易,请参见下面的示例(有 4 个时间点):

library(lavaan)
model <- ' i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
           s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4 '
fit <- growth(model,data=Demo.growth)
summary(fit)
#> lavaan 0.6-8 ended normally after 29 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                         9
#>                                                       
#>   Number of observations                           400
#>                                                       
#> Model Test User Model:
#>                                                       
#>   Test statistic                                 8.069
#>   Degrees of freedom                                 5
#>   P-value (Chi-square)                           0.152
#> 
#> Parameter Estimates:
#> 
#>   Standard errors                             Standard
#>   Information                                 Expected
#>   Information saturated (h1) model          Structured
#> 
#> Latent Variables:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   i =~                                                
#>     t1                1.000                           
#>     t2                1.000                           
#>     t3                1.000                           
#>     t4                1.000                           
#>   s =~                                                
#>     t1                0.000                           
#>     t2                1.000                           
#>     t3                2.000                           
#>     t4                3.000                           
#> 
#> Covariances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   i ~~                                                
#>     s                 0.618    0.071    8.686    0.000
#> 
#> Intercepts:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .t1                0.000                           
#>    .t2                0.000                           
#>    .t3                0.000                           
#>    .t4                0.000                           
#>     i                 0.615    0.077    8.007    0.000
#>     s                 1.006    0.042   24.076    0.000
#> 
#> Variances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .t1                0.595    0.086    6.944    0.000
#>    .t2                0.676    0.061   11.061    0.000
#>    .t3                0.635    0.072    8.761    0.000
#>    .t4                0.508    0.124    4.090    0.000
#>     i                 1.932    0.173   11.194    0.000
#>     s                 0.587    0.052   11.336    0.000

但是,如果您想为 2 个并行过程(睡眠和焦虑)的潜在增长曲线建模,您可以使用以下方法:

library(lavaan)
#> This is lavaan 0.6-8
#> lavaan is FREE software! Please report any bugs.
model <- "
i1 =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
s1 =~ 0*t1 + 1*t2 + 2*t3 + 3*t4


i2 =~ 1*c1 + 1*c2 + 1*c3 + 1*c4
s2 =~ 0*c1 + 1*c2 + 2*c3 + 3*c4

s1 ~ i2
s2 ~ i1
"
fit <- growth(model,data=Demo.growth)
#> Warning in lav_object_post_check(object): lavaan WARNING: covariance matrix of latent variables
#>                 is not positive definite;
#>                 use lavInspect(fit,"cov.lv") to investigate.
summary(fit)
#> lavaan 0.6-8 ended normally after 76 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        20
#>                                                       
#>   Number of observations                           400
#>                                                       
#> Model Test User Model:
#>                                                       
#>   Test statistic                               156.195
#>   Degrees of freedom                                24
#>   P-value (Chi-square)                           0.000
#> 
#> Parameter Estimates:
#> 
#>   Standard errors                             Standard
#>   Information                                 Expected
#>   Information saturated (h1) model          Structured
#> 
#> Latent Variables:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   i1 =~                                               
#>     t1                1.000                           
#>     t2                1.000                           
#>     t3                1.000                           
#>     t4                1.000                           
#>   s1 =~                                               
#>     t1                0.000                           
#>     t2                1.000                           
#>     t3                2.000                           
#>     t4                3.000                           
#>   i2 =~                                               
#>     c1                1.000                           
#>     c2                1.000                           
#>     c3                1.000                           
#>     c4                1.000                           
#>   s2 =~                                               
#>     c1                0.000                           
#>     c2                1.000                           
#>     c3                2.000                           
#>     c4                3.000                           
#> 
#> Regressions:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   s1 ~                                                
#>     i2                6.115    3.785    1.615    0.106
#>   s2 ~                                                
#>     i1               -0.011    0.017   -0.644    0.519
#> 
#> Covariances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   i1 ~~                                               
#>     i2                0.101    0.062    1.632    0.103
#>  .s1 ~~                                               
#>    .s2                0.021    0.017    1.205    0.228
#> 
#> Intercepts:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .t1                0.000                           
#>    .t2                0.000                           
#>    .t3                0.000                           
#>    .t4                0.000                           
#>    .c1                0.000                           
#>    .c2                0.000                           
#>    .c3                0.000                           
#>    .c4                0.000                           
#>     i1                0.615    0.077    8.009    0.000
#>    .s1                0.824    0.276    2.990    0.003
#>     i2                0.030    0.041    0.731    0.464
#>    .s2                0.002    0.024    0.063    0.950
#> 
#> Variances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .t1                0.597    0.086    6.978    0.000
#>    .t2                0.673    0.061   11.056    0.000
#>    .t3                0.636    0.072    8.780    0.000
#>    .t4                0.507    0.124    4.095    0.000
#>    .c1                0.977    0.069   14.120    0.000
#>    .c2                0.892    0.064   14.016    0.000
#>    .c3                0.838    0.065   12.996    0.000
#>    .c4                0.803    0.080   10.010    0.000
#>     i1                1.931    0.173   11.193    0.000
#>    .s1                0.533    0.203    2.626    0.009
#>     i2                0.001    0.006    0.246    0.806
#>    .s2                0.007    0.006    1.033    0.302

reprex package (v1.0.0) 于 2021 年 3 月 19 日创建

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...