1
votes

I want to compute a structural equation model with the sem() function in R with the package lavaan.

There are two categorial variables, one latent exogenous and one latent endogenous, I want to include in the final version of the model.

When I include one of the categorial variables in the model, however, R produces the following warning:

1: In estimateVCOV(lavaanModel, samplestats = lavaanSampleStats, options = lavaanOptions, : lavaan WARNING: could not compute standard errors!

2: In computeTestStatistic(lavaanModel, partable = lavaanParTable, : lavaan WARNING: could not compute scaled test statistic

Code used:

model1 <- '

Wertschaetzung_Essen =~ abwechslungsreiche_M + schnell_zubereitbar + koche_sehr_gerne + koche_sehr_haeufig

Fleischverzicht =~ Ern_Index1

Fleischverzicht ~ Wertschaetzung_Essen
'

fit_model1 <- sem(model1, data=survey2_subset, ordered = c("Ern_Index1"))

Note: This is only a small version of the final model and in which I only introduce one categorial variable. The warning, however, is the same for more complex versions of the model.

Output

 str(survey2_subset):


   'data.frame':    3676 obs. of  116 variables:
 $ abwechslungsreiche_M : num  4 2 3 4 3 3 4 3 3 3 ...
 $ schnell_zubereitbar  : num  0 3 2 0 0 1 3 2 1 1 ...
 $ koche_sehr_gerne     : num  1 3 3 1 3 1 4 4 4 3 ...
 $ koche_sehr_haeufig   : num  2 2 3 NA 3 2 2 4 3 3 ...
 $ Ern_Index1           : num  1 1 1 1 0 0 1 0 1 0 ...


 summary(fit_model1, fit.measures = TRUE, standardized=TRUE)

    lavaan (0.5-15) converged normally after  31 iterations

                                                  Used       Total
  Number of observations                          3469        3676

  Estimator                                       DWLS      Robust
  Minimum Function Test Statistic               13.716          NA
  Degrees of freedom                                 4           4
  P-value (Chi-square)                           0.008          NA
  Scaling correction factor                                     NA
  Shift parameter                                     
    for simple second-order correction (Mplus variant)

        Model test baseline model:

  Minimum Function Test Statistic             2176.159    1582.139
  Degrees of freedom                                10          10
  P-value                                        0.000       0.000

       User model versus baseline model:

  Comparative Fit Index (CFI)                    0.996          NA
  Tucker-Lewis Index (TLI)                       0.989          NA

      Root Mean Square Error of Approximation:

  RMSEA                                          0.026          NA
  90 Percent Confidence Interval          0.012  0.042          NA     NA
  P-value RMSEA <= 0.05                          0.994          NA

   Parameter estimates:

  Information                                 Expected
  Standard Errors                           Robust.sem

          Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
  Latent variables:
  Wertschaetzung_Essen =~
    abwchslngsr_M     1.000                               0.363    0.436
    schnll_zbrtbr     1.179                               0.428    0.438
    koche_shr_grn     2.549                               0.925    0.846
    koche_shr_hfg     2.530                               0.918    0.775
  Fleischverzicht =~
    Ern_Index1        1.000                               0.249    0.249

Regressions:
  Fleischverzicht ~
    Wrtschtzng_Es     0.302                               0.440    0.440

Intercepts:
    abwchslngsr_M     3.133                               3.133    3.760
    schnll_zbrtbr     1.701                               1.701    1.741
    koche_shr_grn     2.978                               2.978    2.725
    koche_shr_hfg     2.543                               2.543    2.148
    Wrtschtzng_Es     0.000                               0.000    0.000
    Fleischvrzcht     0.000                               0.000    0.000

Thresholds:
    Ern_Index1|t1     0.197                               0.197    0.197

Variances:
    abwchslngsr_M     0.562                               0.562    0.810
    schnll_zbrtbr     0.771                               0.771    0.808
    koche_shr_grn     0.339                               0.339    0.284
    koche_shr_hfg     0.559                               0.559    0.399
    Ern_Index1        0.938                               0.938    0.938
    Wrtschtzng_Es     0.132                               1.000    1.000
    Fleischvrzcht     0.050                               0.806    0.806

Is the model not identified? There should be enough degrees of freedom and the loadings of the first manifest items are set to one.

How can I resolve this issue?

1
at the very least you need to provide the output of str(survey2_subset) - IRTFM
and I would imagine that there is a summary function for such objects, night wahr? - IRTFM
Hi BondedDust, I had problems with formatting... - user3515360
I hope that the information provided now is sufficient and allows one to help me - user3515360

1 Answers

0
votes

My first thought was:

You can´t have missing values in the dataframe, because with categorial variables WLSMV is used and FIML (missing="ML") is only usable with ML estimates. Perhaps that´s a problem.

Also: Does lavaan automatically fix the residual-variance of "Fleischverzicht" to 0 (or some other value)? A single-item latent variable would not be identified without that, I think.