Latent change model, negative variance

91 views
Skip to first unread message

cezre...@gmail.com

unread,
Feb 28, 2019, 5:42:07 PM2/28/19
to lavaan
Hello,

I have a latent variable change model I have fit below. I have measurements at 2 time points and I have 3 groups. When I include all 3 groups, I get the standard "Warning message: In lav_object_post_check(object) :   lavaan WARNING: some estimated lv variances are negative" ". I copy the output below for the model with 3 groups. However, when I drop one of the groups (that seems to be the problem), the code runs fine. So this leads me to believe that this is NOT a model mis-specification issue but, rather, something with the data of the group I dropped. I do know the post-scores decrease some, relative to the pre-scores, for that group and I am wondering if that might be contributing to the problem. I don't see any extreme values (i.e. outliers) that might cause this issue. Any thoughts on what might be driving the error and how to deal with it? I can provide the output for running the model when I drop the one group, if that is helpful. 



mod2<-'
pre.wm=~1*RSpan1+1*SSpan1       #Specifies the measurement model for pre.wm 
post.wm=~1*RSpan2+equal(pre.wm=~SSpan1)*SSpan2   #Specifies the measurement model for post.wm 

post.wm ~ 1*pre.wm     #Fixed regression of post.wm on pre.wm
dCOG1 =~ 1*post.wm     #Fixed regression of dCOG1 on post.wm
post.wm ~ 0*1          #Intercept of post.wm constrained to 0
post.wm ~~ 0*post.wm   #Fixes variance of post.wm to 0 

dCOG1 ~ 1             #Estimates intercept of change score 
pre.wm ~  1           #Estimates intercept of pre.wm 
dCOG1 ~~  dCOG1       #Estimates variance of change score 
pre.wm ~~   pre.wm    #Estimates variance of pre.wm 
dCOG1~pre.wm          #Estimates the self-feedback parameter

RSpan1~~RSpan2   #Allows residual covariance on RSpan across T1 and T2
SSpan1~~SSpan2   #Allows residual covariance on RSpan across T1 and T2

RSpan1~~RSpan1   #Allows residual variance on RSpan at T1
SSpan1~~SSpan1   #Allows residual variance on SSpan at T1

RSpan2~~equal("RSpan1~~RSpan1")*RSpan2  #Allows residual variance on RSpan at T2 
SSpan2~~equal("SSpan1~~SSpan1")*SSpan2  #Allows residual variance on SSpan at T2 

RSpan1~0*1                 #Constrains intercept of RSpan to 0 at T1
SSpan1~1                   #Estimates the intercept of SSpan at T1
RSpan2~0*1                 #Constrains the intercept of RSpan to 0 at T2
SSpan2~equal("SSpan1~1")*1   #Estimates the intercept of SSpan at T2
'
fitmod2 <- lavaan(mod2, data=all,group='Group' , estimator='mlr',fixed.x=T,missing='fiml') #fixed.x=T regards all exogenuous covariates as estimated
summary(fitmod2, fit.measures=TRUE, standardized=TRUE, rsquare=TRUE)


Warning message:
In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
> summary(fitmod2, fit.measures=TRUE, standardized=TRUE, rsquare=TRUE)
lavaan 0.6-3 ended normally after 55 iterations

  Optimization method                           NLMINB
  Number of free parameters                         42
  Number of equality constraints                     3

  Number of observations per group         
  1                                                 70
  2                                                 78
  5                                                 99
  Number of missing patterns per group     
  1                                                  2
  2                                                  2
  5                                                  2

  Estimator                                         ML      Robust
  Model Fit Test Statistic                       5.252       5.775
  Degrees of freedom                                 3           3
  P-value (Chi-square)                           0.154       0.123
  Scaling correction factor                                  0.909
    for the Yuan-Bentler correction (Mplus variant)

Chi-square for each group:

  1                                              5.252       5.775
  2                                              0.000       0.000
  5                                              0.000       0.000

Model test baseline model:

  Minimum Function Test Statistic              271.474     234.809
  Degrees of freedom                                18          18
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.991       0.987
  Tucker-Lewis Index (TLI)                       0.947       0.923

  Robust Comparative Fit Index (CFI)                         0.990
  Robust Tucker-Lewis Index (TLI)                            0.940

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -1149.830   -1149.830
  Scaling correction factor                                  0.984
    for the MLR correction
  Loglikelihood unrestricted model (H1)      -1147.204   -1147.204
  Scaling correction factor                                  1.049
    for the MLR correction

  Number of free parameters                         39          39
  Akaike (AIC)                                2377.661    2377.661
  Bayesian (BIC)                              2514.527    2514.527
  Sample-size adjusted Bayesian (BIC)         2390.897    2390.897

Root Mean Square Error of Approximation:

  RMSEA                                          0.095       0.106
  90 Percent Confidence Interval          0.000  0.228       0.000  0.242
  P-value RMSEA <= 0.05                          0.226       0.192

  Robust RMSEA                                               0.101
  90 Percent Confidence Interval                             0.000  0.225

Standardized Root Mean Square Residual:

  SRMR                                           0.012       0.012

Parameter Estimates:

  Information                                 Observed
  Observed information based on                Hessian
  Standard Errors                   Robust.huber.white


Group 1 [1]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.722    0.691
    SSpan1            1.000                               0.722    0.783
  post.wm =~                                                            
    RSpan2            1.000                               0.770    0.713
    SSpan2  (SSp1)    1.030    0.300    3.440    0.001    0.793    0.810
  dCOG1 =~                                                              
    post.wm           1.000                               0.541    0.541

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               0.938    0.938
  dCOG1 ~                                                               
    pre.wm           -0.099    0.203   -0.486    0.627   -0.171   -0.171

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2            0.262    0.164    1.598    0.110    0.262    0.458
 .SSpan1 ~~                                                             
   .SSpan2            0.028    0.154    0.185    0.854    0.028    0.086

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.151    0.091    1.660    0.097    0.362    0.362
    pre.wm            0.003    0.118    0.028    0.978    0.005    0.005
   .RSpan1            0.000                               0.000    0.000
   .SSpan1  (.21.)    0.061    0.094    0.655    0.513    0.061    0.067
   .RSpan2            0.000                               0.000    0.000
   .SSpan2  (SS1~)    0.061    0.094    0.655    0.513    0.061    0.063

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.168    0.112    1.504    0.133    0.971    0.971
    pre.wm            0.522    0.118    4.408    0.000    1.000    1.000
   .RSpan1  (.16.)    0.571    0.191    2.985    0.003    0.571    0.523
   .SSpan1  (.17.)    0.330    0.160    2.061    0.039    0.330    0.387
   .RSpan2  (RS1~)    0.571    0.191    2.985    0.003    0.571    0.491
   .SSpan2  (SS1~)    0.330    0.160    2.061    0.039    0.330    0.344

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1             0.029
    RSpan1            0.477
    SSpan1            0.613
    RSpan2            0.509
    SSpan2            0.656


Group 2 [2]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.719    0.706
    SSpan1            1.000                               0.719    0.700
  post.wm =~                                                            
    RSpan2            1.000                               0.493    0.522
    SSpan2            1.436    0.421    3.407    0.001    0.708    0.775
  dCOG1 =~                                                              
    post.wm           1.000                                 NaN      NaN

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               1.459    1.459
  dCOG1 ~                                                               
    pre.wm           -0.264    0.216   -1.226    0.220      NaN      NaN

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2            0.039    0.116    0.333    0.739    0.039    0.067
 .SSpan1 ~~                                                             
   .SSpan2           -0.003    0.098   -0.028    0.978   -0.003   -0.007

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.086    0.102   -0.846    0.398      NaN      NaN
    pre.wm            0.128    0.117    1.096    0.273    0.178    0.178
   .RSpan1            0.000                               0.000    0.000
   .SSpan1            0.024    0.118    0.202    0.840    0.024    0.023
   .RSpan2            0.000                               0.000    0.000
   .SSpan2           -0.020    0.145   -0.135    0.893   -0.020   -0.021

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.037    0.075   -0.495    0.621      NaN      NaN
    pre.wm            0.518    0.133    3.895    0.000    1.000    1.000
   .RSpan1            0.520    0.158    3.289    0.001    0.520    0.501
   .SSpan1            0.538    0.129    4.167    0.000    0.538    0.509
   .RSpan2            0.650    0.132    4.924    0.000    0.650    0.728
   .SSpan2            0.334    0.150    2.229    0.026    0.334    0.400

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1               NaN
    RSpan1            0.499
    SSpan1            0.491
    RSpan2            0.272
    SSpan2            0.600


Group 3 [5]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.693    0.709
    SSpan1            1.000                               0.693    0.683
  post.wm =~                                                            
    RSpan2            1.000                               0.502    0.576
    SSpan2            1.494    0.619    2.414    0.016    0.750    0.699
  dCOG1 =~                                                              
    post.wm           1.000                               0.521    0.521

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               1.380    1.380
  dCOG1 ~                                                               
    pre.wm           -0.309    0.196   -1.576    0.115   -0.818   -0.818

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2            0.023    0.165    0.136    0.892    0.023    0.046
 .SSpan1 ~~                                                             
   .SSpan2            0.142    0.167    0.851    0.394    0.142    0.249

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.149    0.103   -1.448    0.148   -0.567   -0.567
    pre.wm           -0.067    0.098   -0.686    0.493   -0.097   -0.097
   .RSpan1            0.000                               0.000    0.000
   .SSpan1           -0.092    0.102   -0.902    0.367   -0.092   -0.090
   .RSpan2            0.000                               0.000    0.000
   .SSpan2            0.095    0.201    0.473    0.636    0.095    0.088

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.023    0.075    0.304    0.761    0.331    0.331
    pre.wm            0.480    0.110    4.384    0.000    1.000    1.000
   .RSpan1            0.475    0.139    3.414    0.001    0.475    0.497
   .SSpan1            0.550    0.095    5.762    0.000    0.550    0.534
   .RSpan2            0.507    0.159    3.197    0.001    0.507    0.668
   .SSpan2            0.590    0.284    2.078    0.038    0.590    0.512

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1             0.669
    RSpan1            0.503
    SSpan1            0.466
    RSpan2            0.332
    SSpan2            0.488

Terrence Jorgensen

unread,
Feb 28, 2019, 10:42:36 PM2/28/19
to lavaan
when I drop one of the groups (that seems to be the problem), the code runs fine. 

The code seems to run fine even in the example you posted.  There don't seem to be any equality constraints across groups, so I don't see why results should differ when you remove a group.  I suspect it has something to do with the fact that only the first group has any df, which is probably due to your use of the equal()* operator instead of simply assigning labels to parameters.  When you have multiple groups, I'm not sure the equal()* operator applies that constraint across all groups.  Better to label your parameters.


Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

cezre...@gmail.com

unread,
Mar 1, 2019, 2:23:00 PM3/1/19
to lavaan
Thanks for your response, Terrence. I have updated the code as you suggested; but the problem still remains. Group 2 still has a negative variance for dCog1 (and the warning goes away when I drop Group 2 from the analysis). I am not sure what you mean by only the 1st group has any df. Any other thoughts? Is it critical that I don't have a negative variance before proceeding to use the model results? Everything else is fine...

mod2<-'
pre.wm=~1*RSpan1+1*SSpan1       #Specifies the measurement model for pre.wm 
post.wm=~1*RSpan2+1*SSpan2   #Specifies the measurement model for post.wm 

post.wm ~ 1*pre.wm     #Fixed regression of post.wm on pre.wm
dCOG1 =~ 1*post.wm     #Fixed regression of dCOG1 on post.wm
post.wm ~ 0*1          #Intercept of post.wm constrained to 0
post.wm ~~ 0*post.wm   #Fixes variance of post.wm to 0 

dCOG1 ~ 1             #Estimates intercept of change score 
pre.wm ~  1           #Estimates intercept of pre.wm 
dCOG1 ~~  dCOG1       #Estimates variance of change score 
pre.wm ~~   pre.wm    #Estimates variance of pre.wm 
dCOG1~pre.wm          #Estimates the self-feedback parameter

RSpan1~~RSpan2   #Allows residual covariance on RSpan across T1 and T2
SSpan1~~SSpan2   #Allows residual covariance on RSpan across T1 and T2

RSpan1~~a*RSpan1   #Allows residual variance on RSpan at T1
SSpan1~~b*SSpan1   #Allows residual variance on SSpan at T1

RSpan2~~a*RSpan2  #Allows residual variance on RSpan at T2 
SSpan2~~b*SSpan2  #Allows residual variance on SSpan at T2 

RSpan1~0*1                 #Constrains intercept of RSpan to 0 at T1
SSpan1~c*1                   #Estimates the intercept of SSpan at T1
RSpan2~0*1                 #Constrains the intercept of RSpan to 0 at T2
SSpan2~c*1   #Estimates the intercept of SSpan at T2
'
fitmod2 <- lavaan(mod2, data=all,group='Group' , estimator='mlr',fixed.x=T,missing='fiml') #fixed.x=T regards all exogenuous covariates as estimated

summary(fitmod2, fit.measures=TRUE, standardized=TRUE, rsquare=TRUE)

Warning message:
In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
> summary(fitmod2, fit.measures=TRUE, standardized=TRUE, rsquare=TRUE)
lavaan 0.6-3 ended normally after 34 iterations

  Optimization method                           NLMINB
  Number of free parameters                         39
  Number of equality constraints                     3

  Number of observations per group         
  1                                                 70
  2                                                 78
  5                                                 99
  Number of missing patterns per group     
  1                                                  2
  2                                                  2
  5                                                  2

  Estimator                                         ML      Robust
  Model Fit Test Statistic                       7.960       7.526
  Degrees of freedom                                 6           6
  P-value (Chi-square)                           0.241       0.275
  Scaling correction factor                                  1.058
    for the Yuan-Bentler correction (Mplus variant)

Chi-square for each group:

  1                                              5.267       4.980
  2                                              1.443       1.364
  5                                              1.250       1.181

Model test baseline model:

  Minimum Function Test Statistic              271.474     234.809
  Degrees of freedom                                18          18
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.992       0.993
  Tucker-Lewis Index (TLI)                       0.977       0.979

  Robust Comparative Fit Index (CFI)                         0.994
  Robust Tucker-Lewis Index (TLI)                            0.981

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -1151.184   -1151.184
  Scaling correction factor                                  0.967
    for the MLR correction
  Loglikelihood unrestricted model (H1)      -1147.204   -1147.204
  Scaling correction factor                                  1.049
    for the MLR correction

  Number of free parameters                         36          36
  Akaike (AIC)                                2374.369    2374.369
  Bayesian (BIC)                              2500.707    2500.707
  Sample-size adjusted Bayesian (BIC)         2386.587    2386.587

Root Mean Square Error of Approximation:

  RMSEA                                          0.063       0.056
  90 Percent Confidence Interval          0.000  0.166       0.000  0.158
  P-value RMSEA <= 0.05                          0.361       0.400

  Robust RMSEA                                               0.057
  90 Percent Confidence Interval                             0.000  0.166

Standardized Root Mean Square Residual:

  SRMR                                           0.043       0.043

Parameter Estimates:

  Information                                 Observed
  Observed information based on                Hessian
  Standard Errors                   Robust.huber.white


Group 1 [1]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.720    0.694
    SSpan1            1.000                               0.720    0.777
  post.wm =~                                                            
    RSpan2            1.000                               0.782    0.723
    SSpan2            1.000                               0.782    0.801
  dCOG1 =~                                                              
    post.wm           1.000                               0.539    0.539

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               0.921    0.921
  dCOG1 ~                                                               
    pre.wm           -0.082    0.120   -0.679    0.497   -0.140   -0.140

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2            0.252    0.116    2.164    0.030    0.252    0.449
 .SSpan1 ~~                                                             
   .SSpan2            0.038    0.101    0.379    0.705    0.038    0.112

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.153    0.082    1.877    0.061    0.364    0.364
    pre.wm            0.003    0.117    0.023    0.982    0.004    0.004
   .RSpan1            0.000                               0.000    0.000
   .SSpan1     (c)    0.063    0.092    0.680    0.496    0.063    0.068
   .RSpan2            0.000                               0.000    0.000
   .SSpan2     (c)    0.063    0.092    0.680    0.496    0.063    0.064

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.174    0.088    1.971    0.049    0.981    0.981
    pre.wm            0.519    0.109    4.775    0.000    1.000    1.000
   .RSpan1     (a)    0.560    0.135    4.157    0.000    0.560    0.519
   .SSpan1     (b)    0.341    0.093    3.676    0.000    0.341    0.397
   .RSpan2     (a)    0.560    0.135    4.157    0.000    0.560    0.478
   .SSpan2     (b)    0.341    0.093    3.676    0.000    0.341    0.358

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1             0.019
    RSpan1            0.481
    SSpan1            0.603
    RSpan2            0.522
    SSpan2            0.642


Group 2 [2]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.716    0.723
    SSpan1            1.000                               0.716    0.677
  post.wm =~                                                            
    RSpan2            1.000                               0.607    0.620
    SSpan2            1.000                               0.607    0.681
  dCOG1 =~                                                              
    post.wm           1.000                                 NaN      NaN

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               1.178    1.178
  dCOG1 ~                                                               
    pre.wm           -0.062    0.155   -0.403    0.687      NaN      NaN

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2           -0.049    0.099   -0.492    0.623   -0.049   -0.093
 .SSpan1 ~~                                                             
   .SSpan2            0.067    0.083    0.810    0.418    0.067    0.132

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.111    0.118   -0.935    0.350      NaN      NaN
    pre.wm            0.126    0.116    1.088    0.277    0.177    0.177
   .RSpan1            0.000                               0.000    0.000
   .SSpan1            0.028    0.118    0.235    0.814    0.028    0.026
   .RSpan2            0.000                               0.000    0.000
   .SSpan2           -0.016    0.115   -0.141    0.888   -0.016   -0.018

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.081    0.100   -0.812    0.417      NaN      NaN
    pre.wm            0.512    0.130    3.936    0.000    1.000    1.000
   .RSpan1            0.467    0.139    3.367    0.001    0.467    0.477
   .SSpan1            0.604    0.121    4.977    0.000    0.604    0.541
   .RSpan2            0.590    0.136    4.339    0.000    0.590    0.615
   .SSpan2            0.426    0.086    4.963    0.000    0.426    0.536

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1               NaN
    RSpan1            0.523
    SSpan1            0.459
    RSpan2            0.385
    SSpan2            0.464


Group 3 [5]:

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  pre.wm =~                                                             
    RSpan1            1.000                               0.682    0.710
    SSpan1            1.000                               0.682    0.665
  post.wm =~                                                            
    RSpan2            1.000                               0.624    0.695
    SSpan2            1.000                               0.624    0.595
  dCOG1 =~                                                              
    post.wm           1.000                               0.336    0.336

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  post.wm ~                                                             
    pre.wm            1.000                               1.094    1.094
  dCOG1 ~                                                               
    pre.wm           -0.129    0.231   -0.560    0.576   -0.422   -0.422

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
 .RSpan1 ~~                                                             
   .RSpan2           -0.043    0.119   -0.359    0.720   -0.043   -0.098
 .SSpan1 ~~                                                             
   .SSpan2            0.215    0.116    1.856    0.063    0.215    0.334

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1            -0.136    0.113   -1.204    0.228   -0.649   -0.649
    pre.wm           -0.067    0.098   -0.686    0.493   -0.099   -0.099
   .RSpan1            0.000                               0.000    0.000
   .SSpan1           -0.092    0.102   -0.902    0.367   -0.092   -0.089
   .RSpan2            0.000                               0.000    0.000
   .SSpan2           -0.003    0.132   -0.019    0.984   -0.003   -0.002

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .post.wm           0.000                               0.000    0.000
   .dCOG1             0.036    0.115    0.313    0.754    0.822    0.822
    pre.wm            0.466    0.110    4.237    0.000    1.000    1.000
   .RSpan1            0.458    0.127    3.615    0.000    0.458    0.496
   .SSpan1            0.586    0.106    5.531    0.000    0.586    0.557
   .RSpan2            0.417    0.120    3.464    0.001    0.417    0.517
   .SSpan2            0.711    0.137    5.194    0.000    0.711    0.646

R-Square:
                   Estimate
    post.wm           1.000
    dCOG1             0.178
    RSpan1            0.504
    SSpan1            0.443
    RSpan2            0.483
    SSpan2            0.354

Terrence Jorgensen

unread,
Mar 6, 2019, 2:26:15 PM3/6/19
to lavaan
I have updated the code as you suggested

No, you are still only providing one label, instead of a vector of labels. For instance, this equality constraint only applies to the first group (as you can verify by paying attention to the labels in your summary() output for group 1 vs. 2 and 3).

RSpan1~~a*RSpan1   #Allows residual variance on RSpan at T1
RSpan2~~a*RSpan2  #Allows residual variance on RSpan at T2

You have 3 groups, so use a vector, as shown in the tutorial page I linked to before

RSpan1~~c(a, a, a)*RSpan1   #Allows residual variance on RSpan at T1
RSpan2~~c(a, a, a)*RSpan2  #Allows residual variance on RSpan at T2

Perhaps your problem will not occur when you fit the model you mean to.

I am not sure what you mean by only the 1st group has any df.

In your original post, the chi-squared contribution was zero in groups 2 and 3, which means those models fit perfectly (which typically only occurs when you have df=0)

Is it critical that I don't have a negative variance before proceeding to use the model results?

No, not if the CI includes positive values

summary(fit, ci = TRUE)


Reply all
Reply to author
Forward
0 new messages