Search code examples
requationsr-lavaan

Model identification in lavaan for R


I'm trying to do a latent variable analysis using the package lavaan for R. However, I'm getting the following error messages:

Warning messages: 1: In lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate 2: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: could not compute standard errors! lavaan NOTE: this may be a symptom that the model is not identified. 3: In lav_object_post_check(object) : lavaan WARNING: some estimated ov variances are negative 4: In lav_object_post_check(object) :
lavaan WARNING: some estimated lv variances are negative

My model is structured as follows:

enter image description here

model <- "
        # regressions
        eigenvector.frug ~ Size + Morphology

        # latent variables
        Size =~ Mass + Forearm
        Morphology =~ LMT + BUM

        # covariances and variances
        Mass ~~ Forearm
        LMT ~~ BUM
        Mass ~~ Mass
        Forearm ~~ Forearm
        LMT ~~ LMT
        BUM ~~ BUM
        "

The code I'm running is:

fit <- sem(model, data=data,
           orthogonal=TRUE)

And I'm getting the following summary:

lavaan (0.5-23.1097) converged normally after 141 iterations

  Number of observations                            41

  Estimator                                         ML
  Minimum Function Test Statistic               88.676
  Degrees of freedom                                 2
  P-value (Chi-square)                           0.000

Parameter Estimates:

  Information                                 Expected
  Standard Errors                             Standard

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  Size =~                                             
    Mass              1.000                           
    Forearm           4.941       NA                  
  Morphology =~                                       
    LMT               1.000                           
    BUM               1.349       NA                  

Regressions:
                     Estimate  Std.Err  z-value  P(>|z|)
  eigenvector.frug ~                                    
    Size               -0.000       NA                  
    Morphology         -2.774       NA                  

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
 .Mass ~~                                             
   .Forearm          59.805       NA                  
 .LMT ~~                                              
   .BUM               2.926       NA                  
  Size ~~                                             
    Morphology        0.000                           

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .Mass            272.184       NA                  
   .Forearm        -518.752       NA                  
   .LMT               3.283       NA                  
   .BUM               5.871       NA                  
   .eigenvectr.frg    0.344       NA                  
    Size             26.894       NA                  
    Morphology       -0.038       NA    

As the data vary at different scales, I tried to normalize all variables using the scale function and run the model again.

data2 = scale(data)

Then I got the following error messages:

Warning message: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: could not compute standard errors! lavaan NOTE: this may be a symptom that the model is not identified.

And the following summary:

lavaan (0.5-23.1097) converged normally after  69 iterations

  Number of observations                            41

  Estimator                                         ML
  Minimum Function Test Statistic               87.973
  Degrees of freedom                                 2
  P-value (Chi-square)                           0.000

Parameter Estimates:

  Information                                 Expected
  Standard Errors                             Standard

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  Size =~                                             
    Mass              1.000                           
    Forearm           0.940       NA                  
  Morphology =~                                       
    LMT               1.000                           
    BUM               0.181       NA                  

Regressions:
                     Estimate  Std.Err  z-value  P(>|z|)
  eigenvector.frug ~                                    
    Size                0.536       NA                  
    Morphology         -0.042       NA                  

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
 .Mass ~~                                             
   .Forearm           0.389       NA                  
 .LMT ~~                                              
   .BUM               0.541       NA                  
  Size ~~                                             
    Morphology        0.000                           

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .Mass              0.404       NA                  
   .Forearm           0.471       NA                  
   .LMT               0.394       NA                  
   .BUM               0.957       NA                  
   .eigenvectr.frg    0.819       NA                  
    Size              0.571       NA                  
    Morphology        0.581       NA         

Could you please help me figure out what's wrong? Thank you very much.


Solution

  • I believe the problem is the correlated residuals between indicators on the same construct. You are trying to explain the relationship between indicators on the same construct in redundant ways.

    For example, the the latent construct "size" could explain the relationship between the indicator variables "mass" and "forearm." The residuals there would be conceptualized as the variance in the indicator that is not explained by the latent construct.

    But then what you do is let the residuals correlate, which models the shared variance between "mass" and "forearm" that is not explained by the latent factor.

    The problem lies in the fact that your latent construct is only made up of those two variables. You are basically telling lavaan: "Model the variance between these two indicators as a latent construct... No wait! Also model that same variance as a residual!" So lavaan is basically telling you, "That doesn't make sense, I can't do that!" I would try this code:

    model2 <- "
            # regressions
            eigenvector.frug ~ Size + Morphology
    
            # latent variables
            Size =~ Mass + Forearm
            Morphology =~ LMT + BUM
    
            # covariances and variances
            Mass ~~ Mass
            Forearm ~~ Forearm
            LMT ~~ LMT
            BUM ~~ BUM
            "
    

    This code implicitly fixes the residual covariances to zero.

    Another issue you might run into still is that each sub-model is not identified. For each latent variable, you are trying to estimate a latent construct from 2 indicators, which is not identified (i.e., you have 3 variance-related elements to work with, but you are estimating 2 residuals, a loading, and a latent variance). To get around this, you could constrain the loadings for each latent factor to be equivalent to one another. we can do this by assigning the factor loadings with the same label (here, "a" and "b" for each factor).

    model3 <- "
            # regressions
            eigenvector.frug ~ Size + Morphology
    
            # latent variables
            Size =~ a*Mass + a*Forearm
            Morphology =~ b*LMT + b*BUM
    
            # covariances and variances
            Mass ~~ Mass
            Forearm ~~ Forearm
            LMT ~~ LMT
            BUM ~~ BUM
            "