Multiple Causes and Indicators coding error (formative latent variables)

1,203 views
Skip to first unread message

Daca 33

unread,
Nov 21, 2014, 11:59:47 AM11/21/14
to lav...@googlegroups.com
Hi all,

I am trying to write the syntax for my model using the lavaan package in R and I am getting a rather long error message regarding my code. 

I am not sure if I did this correctly given the path diagram (path diagram picture included in the attachment). I think my biggest problem is not knowing if I programmed my formative latent variables correctly.

In addition, I need to standardize coefficients for real GDP Growth (y2) and GDP per capita (y4). Does my code below currently do this for me or am I missing an important step?

Thank you in advance for help. 

> data1 <- read.csv("/Users/demkic/Documents/R/specification1.csv", header=T)
> library(lava an)

This is lavaan 0.5-17
lavaan is BETA software! Please report any bugs.

> SE.Model <- '
+ #regressions
+ SE <~ X5 + X6 + X2 + X1
+ C <~ X7 + X11 + X10 + X8
+ #latent variable definitions
+ SE =~ Y2 + Y3 + Y1
+ C =~ Y4 + Y5 + Y6'
> fitSE <- sem(SE.Model, data = data1)
Warning messages:
1: In lav_data_full(data = data, group = group, group.label = group.label,  :
  lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate
2: In lav_data_full(data = data, group = group, group.label = group.label,  :
  lavaan WARNING: small number of observations (nobs < nvar)
  nobs = 8 nvar = 14
3: In lav_samplestats_from_data(lavdata = lavdata, missing = lavoptions$missing,  :
  lavaan WARNING: sample covariance can not be inverted
4: 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.

5: In lavaan::lavaan(model = SE.Model, data = data1, model.type = "sem",  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.
Screen Shot 2014-11-21 at 5.50.39 PM.png

Daca 33

unread,
Nov 21, 2014, 12:09:01 PM11/21/14
to lav...@googlegroups.com
In addition here is my output:

> summary(fitSE, standardized=TRUE, fit.measures=TRUE)
lavaan (0.5-17) converged normally after 877 iterations

  Number of observations                             8

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

Model test baseline model:

  Minimum Function Test Statistic              251.084
  Degrees of freedom                                63
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.388
  Tucker-Lewis Index (TLI)                       0.229

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)                 96.711
  Loglikelihood unrestricted model (H1)        179.224

  Number of free parameters                         19
  Akaike (AIC)                                -155.423
  Bayesian (BIC)                              -153.913
  Sample-size adjusted Bayesian (BIC)         -210.056

Root Mean Square Error of Approximation:

  RMSEA                                          0.536
  90 Percent Confidence Interval          0.447  0.628
  P-value RMSEA <= 0.05                          0.000

Standardized Root Mean Square Residual:

  SRMR                                           0.171

Parameter estimates:

  Information                                 Expected
  Standard Errors                             Standard

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  SE =~
    Y2                1.000                               0.038    0.858
    Y3                0.085                               0.003    0.472
    Y1                1.125                               0.042    0.951
  C =~
    Y4                1.000                            1051.539    0.627
    Y5               -0.001                              -0.633   -0.981
    Y6               -0.000                              -0.219   -0.910

Composites:
  SE <~
    X5               -0.064                              -1.694   -0.113
    X6               -0.767                             -20.362   -0.474
    X2                0.173                               4.606    1.137
    X1                0.279                               7.407    2.121
  C <~
    X7              215.516                               0.205    0.015
    X11              31.308                               0.030    0.141
    X10           -1046.114                              -0.995   -0.353
    X8             9748.954                               9.271    0.742

Covariances:
  SE ~~
    C                 1.879                                 Inf      Inf

Variances:
    Y2                0.001                               0.001    0.264
    Y3                0.000                               0.000    0.777
    Y1                0.000                               0.000    0.096
    Y4            1710726.574                            1710726.574    0.607
    Y5                0.016                               0.016    0.038
    Y6                0.010                               0.010    0.173
    SE                0.000                               0.000    0.000
    C                 0.000                               0.000    0.000

Edward Rigdon

unread,
Nov 21, 2014, 12:40:38 PM11/21/14
to lav...@googlegroups.com
     Your 14 observed variables produce 105 max Degrees of freedom for the covariance structure model.  Your estimated model has only 50 degrees of freedom, so you are estimating105 - 50 = 55 parameters, based on 8 observations on 14 variables.  The warning messages are just telling you that this is not going well, which is what one ought to expect.  All of these warning messages can be tied to low sample size.  That appears to be the central problem.
--Ed Rigdon

Sent from my iPad
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Daca 33

unread,
Nov 21, 2014, 5:04:40 PM11/21/14
to lav...@googlegroups.com
Thank you for the reply. I will add some more observations to my data

Based on my path diagram, is my model correctly specified below?
(I am having trouble finding literature in lavaan on how to code formative latent variables)

> SE.Model <- '
+ #regressions
+ SE <~ X5 + X6 + X2 + X1
+ C <~ X7 + X11 + X10 + X8
+ #latent variable definitions
+ SE =~ Y2 + Y3 + Y1
+ C =~ Y4 + Y5 + Y6'

thank you

Best,
Daria

yrosseel

unread,
Nov 27, 2014, 1:44:48 PM11/27/14
to lav...@googlegroups.com
On 11/21/2014 11:04 PM, Daca 33 wrote:
> Thank you for the reply. I will add some more observations to my data
>
> Based on my path diagram, is my model correctly specified below?
> (I am having trouble finding literature in lavaan on how to code
> formative latent variables)
>
> > SE.Model <- '
> + #regressions
> + SE <~ X5 + X6 + X2 + X1
> + C <~ X7 + X11 + X10 + X8
> +
> + #latent variable definitions
> + SE =~ Y2 + Y3 + Y1
> + C =~ Y4 + Y5 + Y6'

No. You can 'define' the latent variables only once. I would create them
as reflective factors, and then add the regressions:

SE =~ Y2 + Y3 + Y1
C =~ Y4 + Y5 + Y6

E ~ X5 + X6 + X2 + X1
C ~ X7 + X11 + X10 + X8

Yves.

Daca 33

unread,
Nov 30, 2014, 11:36:18 AM11/30/14
to lav...@googlegroups.com
Code:
SE.Model <- '
#regressions
SE ~ Businessreg + UnemplRate + Trans.Subs + Govconsump
C ~ GovEffect + FiscalFree + BeauCosts + RuleofLaw

#reflective factors
SE =~ RealGDP + LaborForce + M0M1
C =~ GDPperCapita + BribeIndex + Judicialind.'

fit <- sem(SE.Model, data = mydata)
summary(fit, standardized=TRUE, fit.measures=TRUE)


After adding more data and following the advice below, the output I received is:

lavaan (0.5-17) converged normally after 604 iterations

                                                  Used       Total
  Number of observations                            11          23

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

Model test baseline model:

  Minimum Function Test Statistic              380.478
  Degrees of freedom                                63
  P-value                                        0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.180
  Tucker-Lewis Index (TLI)                      -0.076

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)               -121.333
  Loglikelihood unrestricted model (H1)         32.777

  Number of free parameters                         21
  Akaike (AIC)                                 284.666
  Bayesian (BIC)                               293.022
  Sample-size adjusted Bayesian (BIC)          229.791

Root Mean Square Error of Approximation:

  RMSEA                                          0.702
  90 Percent Confidence Interval          0.628  0.778
  P-value RMSEA <= 0.05                          0.000

Standardized Root Mean Square Residual:

  SRMR                                           0.872

Parameter estimates:

  Information                                 Expected
  Standard Errors                             Standard

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  SE =~
    RealGDP           1.000                               8.246    0.979
    LaborForce        0.030                               0.245    0.337
    M0M1              0.011                               0.093    1.005
  C =~
    GDPperCapita      1.000                              14.336    0.005
    BribeIndex       -0.034                              -0.487   -0.981
    Judicialind.     -0.002                              -0.024   -0.058

Regressions:
  SE ~
    Businessreg     -39.952                              -4.845   -0.856
    UnemplRate        1.276                               0.155    0.362
    Trans.Subs       -8.805                              -1.068   -0.316
    Govconsump      -18.037                              -2.187   -0.702
  C ~
    GovEffect       -55.532                              -3.873   -0.401
    FiscalFree        0.916                               0.064    0.303
    BeauCosts        -4.279                              -0.298   -0.449
    RuleofLaw        69.165                               4.824    0.533

Covariances:
  SE ~~
    C               -78.153                              -1.022   -1.022

Variances:
    RealGDP           2.878                               2.878    0.041
    LaborForce        0.468                               0.468    0.887
    M0M1             -0.000                              -0.000   -0.009
    GDPperCapita  8466734.775                            8466734.775    1.000
    BribeIndex        0.009                               0.009    0.038
    Judicialind.      0.174                               0.174    0.997
    SE               48.426                               0.712    0.712
    C               120.722                               0.587    0.587

Warning message:
In sqrt(est[rv.idx]) : NaNs produced

Is this reliable??? What does the warning message that I am receiving mean?

Thank you again,

Best

Edward Rigdon

unread,
Nov 30, 2014, 1:13:42 PM11/30/14
to lav...@googlegroups.com
     You are estimating 57 free parameters on the strength of 11 cases.  No, the results cannot be interpreted.

Sent from my iPad
--

Edward Rigdon

unread,
Nov 30, 2014, 1:15:49 PM11/30/14
to lav...@googlegroups.com
     You are estimating 57 free parameters on the strength of 11 cases.  You should treat the results as a collection of random numbers.
--Ec Rigdon

Sent from my iPad

On Nov 30, 2014, at 11:36 AM, Daca 33 <dem...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages