2

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.

Marco
  • 347
  • 3
  • 18
  • Note that _Warning_ != _Error_. In some instances, warnings can be ignored, assuming you know what you are doing (I have no experience with the techniques you are using). – patrick May 22 '17 at 13:59
  • 3
    In this case, you cannot ignore this warning, since standard errors cannot be computed. – Mark White May 22 '17 at 14:35

1 Answers1

5

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
        "
Mark White
  • 1,228
  • 2
  • 10
  • 25
  • Dear Mark, thank you very much! I need to study this topic further and already ordered two books on latent variable analysis. I ran the test here. Your model3 runs without problems, as no warning messages are shown. However, your model2 get one warning message: "Warning message: In lav_object_post_check(object) : lavaan WARNING: some estimated ov variances are negative". Is that related to the submodes, as you mentioned? In addition, in model3, the Std.Err, z-value, and P(>|z|) are not calculated for the latent variables. Is that ok? – Marco May 23 '17 at 14:24
  • Yeah, that may be because--while the whole model is identified in model2--the submodels (if you look at the latent factors as models on their own) are not identified. model3 seems like a reasonable choice to me. – Mark White May 23 '17 at 14:26
  • Thank you! I'll study more about this kind of analysis. I need to get up to date with it. – Marco May 23 '17 at 14:29
  • The last time I used SEM was 16 years ago, to perform a simple path analysis with calculations by hand. It's impressive how the analytics moved since then. – Marco May 23 '17 at 14:43
  • Dear Mark, I need to add one extra variable to the model3 suggested by you above. However, it has only a single indicator. How should I code this? The latent variable would be called "Geog" and the indicator is "range". Thank you! – Marco Apr 09 '18 at 15:08
  • @Marco you cannot make a latent variable from one indicator. You can just use the column name in the code as you would a latent variable. It will just be one indicator variable working with a number of latent variables. – Mark White Apr 09 '18 at 15:10
  • modelfrug <- " # regressions eigenvector.frug ~ Size + Bite + Skull + range # latent variables Size =~ a*Mass + a*Forearm Bite =~ b*LMT + b*BUM +b*MaxBitFor Skull =~ c*BOB + c*GLSBOB # covariances and variances Mass ~~ Mass Forearm ~~ Forearm LMT ~~ LMT BUM ~~ BUM BOB ~~ BOB GLSBOB ~~ GLSBOB MaxBitFor ~~ MaxBitFor range ~~ range " – Marco Apr 09 '18 at 15:12
  • I'm really grateful. How should I acknowledge you in my paper? – Marco Apr 09 '18 at 15:21
  • I usually just say a thanks to the StackOverflow (or CrossValidated, as is often in my case) community in my acknowledgments. – Mark White Apr 09 '18 at 15:24
  • I'll do that! Thanks. – Marco Apr 09 '18 at 18:41
  • By the way, when I run the updated model and draw the path diagram, the single indicator (rng) is drawn connected to the last latent variable (Skl), no matter where I put it in the equation. Is there a way to draw it directly connected to the response variable? – Marco Apr 09 '18 at 18:45