SEM tree

155 views
Skip to first unread message

Hyoshin Park

unread,
Feb 20, 2015, 4:48:08 PM2/20/15
to lav...@googlegroups.com
Dear all, please help me and save my life!

when I ran the following model (lavaan): two latent variables (independent) to the one binary dependent variable (X9).

growthCurveModel <- '
    X9 ~ c*human + b*distraction;
    distraction ~ a*human;
    human =~ 1*X1 + 1*X6 + 1*X2;
    distraction =~ 1*X3 + 2*X8 + 3*X4;
    human ~~ vari*human; human ~ meani*1;
    distraction ~~ vars*distraction; distraction ~ means*1;
    X1 ~~ residual*X1; X1 ~ 0*1;
    X2 ~~ residual*X2; X2 ~ 0*1;
    X3 ~~ residual*X3; X3 ~ 0*1;
    X4 ~~ residual*X4; X4 ~ 0*1;
    X6 ~~ residual*X6; X6 ~ 0*1;
    X8 ~~ residual*X8; X8 ~ 0*1;
    X9 ~~ residual*X9; X9 ~ 0*1;
'
> run <- lavaan(growthCurveModel,dataset)

I have following warning messages:
Warning messages:
1: 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.
2: In lavaan(growthCurveModel, dataset) :
  lavaan WARNING: some estimated variances are negative
3: In lavaan(growthCurveModel, dataset) :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.

When I tried to fix the dependent variable X9 to be ordered by using 
> run <- lavaan(growthCurveModel,dataset,ordered=c("X9"))

I have following errors: Error in B1 %*% Delta.g : non-conformable arguments
In addition: There were 50 or more warnings (use warnings() to see the first 50)

This is the dataset I used. (dataset <- data.frame(read.csv("C:\\Users\\hyoshin\\Desktop\\R SEMtree\\data2.txt",sep="\t", header=T)))

Thank you!!

X1 X6 X2 X3 X8 X4 X9
0 0 0 0 1 0 0
1 0 0 0 1 1 0
0 1 0 0 1 1 1
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 1
1 0 0 0 0 1 1
0 1 0 0 0 1 1
0 1 0 0 0 0 0
0 1 0 0 0 1 1
0 0 0 1 0 1 0
1 0 0 1 0 1 0
0 1 0 1 0 0 0
0 0 1 0 1 0 1
0 0 1 0 1 1 1
1 0 1 0 1 1 1
0 0 1 0 0 0 0
0 0 1 0 0 0 0
1 0 1 0 0 1 1
1 0 1 0 0 1 1
0 1 1 0 0 1 1
0 1 1 0 0 1 0
1 0 1 1 0 0 1
1 0 1 1 0 1 0
1 0 1 1 0 0 1
0 1 1 1 0 0 1


Hyoshin Park

unread,
Feb 20, 2015, 5:01:02 PM2/20/15
to lav...@googlegroups.com
I also have tried this 

model <- '
    X9 ~ human + distraction;
    distraction ~ human;
    human =~ X1 + X6 + X2;
    distraction =~ X3 + X8 + X4;
    X2 ~~ X2;
    X4 ~~ X4;
    X3 ~~ X1 + X6;
    X8 ~~ X8; 
    X9 ~~ X9; 
'
fit <- sem(model,dataset)

and I got this Warning message:
In lavaan::lavaan(model = model, data = dataset, model.type = "sem",  :
  lavaan WARNING: model has NOT converged!

Hyoshin Park

unread,
Feb 20, 2015, 5:59:32 PM2/20/15
to lav...@googlegroups.com
I have a third try with this! Thank you for helping me!!

model <- '
    X9 ~ c*human + b*distraction;
    distraction ~ a*human;
    human =~ 1*X1 + 1*X6 + 1*X2;
    distraction =~ 1*X3 + 2*X8 + 3*X4;
    human ~~ vari*human; human ~ meani*1;
    distraction ~~ vars*distraction; distraction ~ means*1;
    X1 ~~ e1 * X1;
    X2 ~~ e2 * X2;
    X3 ~~ e3 * X3;
    X4 ~~ e4 * X4;
    X6 ~~ e6 * X6;
    X8 ~~ e8 * X8;
    X9 ~~ e9 * X9;
'
fitMeasures(m1.fit<- lavaan(model,dataset, model.type='sem', sample.cov = x.cov, sample.nobs = N, control=list(x.tol=1e-6), estimator='ML', fixed.x = F, auto.var=F))

warning messages are 
               npar                fmin               chisq                  df              pvalue      baseline.chisq 
             14.000               0.572              29.736              21.000               0.097              36.734 
        baseline.df     baseline.pvalue                 cfi                 tli                nnfi                 rfi 
             21.000               0.018               0.445               0.445               0.445               0.191 
                nfi                pnfi                 ifi                 rni                logl   unrestricted.logl 
              0.191               0.191               0.445               0.445            -117.848            -102.980 
                aic                 bic              ntotal                bic2               rmsea      rmsea.ci.lower 
            263.697             281.310              26.000             237.855               0.126               0.000 
     rmsea.ci.upper        rmsea.pvalue                 rmr          rmr_nomean                srmr        srmr_bentler 
              0.224               0.142               0.049               0.037               0.169               0.169 
srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean          srmr_mplus   srmr_mplus_nomean               cn_05 
              0.168               0.165               0.157               0.171               0.166              29.566 
              cn_01                 gfi                agfi                pgfi                 mfi                ecvi 
             35.041               0.896               0.827               0.538               0.845                  NA 
Warning messages:
1: In lav_partable_check(lavpartable) :
  lavaan WARNING: missing intercepts are set to zero: [X9]
2: In lavaan(model, dataset, model.type = "sem", sample.cov = x.cov,  :
  lavaan WARNING: some estimated variances are negative
3: In lavaan(model, dataset, model.type = "sem", sample.cov = x.cov,  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.
> parameterEstimates(m1.fit, ci=T, boot.ci.type='norm')
           lhs op         rhs label    est    se      z pvalue ci.lower ci.upper
1           X9  ~       human     c -0.721 0.651 -1.106  0.269   -1.997    0.556
2           X9  ~ distraction     b  4.799 1.641  2.925  0.003    1.583    8.014
3  distraction  ~       human     a -0.068 0.117 -0.577  0.564   -0.298    0.162
4        human =~          X1        1.000 0.000     NA     NA    1.000    1.000
5        human =~          X6        1.000 0.000     NA     NA    1.000    1.000
6        human =~          X2        1.000 0.000     NA     NA    1.000    1.000
7  distraction =~          X3        1.000 0.000     NA     NA    1.000    1.000
8  distraction =~          X8        2.000 0.000     NA     NA    2.000    2.000
9  distraction =~          X4        3.000 0.000     NA     NA    3.000    3.000
10       human ~~       human  vari -0.049 0.023 -2.179  0.029   -0.094   -0.005
11       human ~1             meani  0.388 0.042  9.255  0.000    0.306    0.470
12 distraction ~~ distraction  vars  0.004 0.004  0.931  0.352   -0.004    0.011
13 distraction ~1             means  0.198 0.052  3.778  0.000    0.095    0.300
14          X1 ~~          X1    e1  0.275 0.069  3.994  0.000    0.140    0.410
15          X2 ~~          X2    e2  0.353 0.088  4.032  0.000    0.181    0.525
16          X3 ~~          X3    e3  0.213 0.060  3.567  0.000    0.096    0.331
17          X4 ~~          X4    e4  0.210 0.066  3.166  0.002    0.080    0.339
18          X6 ~~          X6    e6  0.247 0.062  3.971  0.000    0.125    0.368
19          X8 ~~          X8    e8  0.182 0.053  3.406  0.001    0.077    0.286
20          X9 ~~          X9    e9  0.214 0.093  2.289  0.022    0.031    0.397
21          X1 ~1                    0.000 0.000     NA     NA    0.000    0.000
22          X6 ~1                    0.000 0.000     NA     NA    0.000    0.000
23          X2 ~1                    0.000 0.000     NA     NA    0.000    0.000
24          X3 ~1                    0.000 0.000     NA     NA    0.000    0.000
25          X8 ~1                    0.000 0.000     NA     NA    0.000    0.000
26          X4 ~1                    0.000 0.000     NA     NA    0.000    0.000
27          X9 ~1                    0.000 0.000     NA     NA    0.000    0.000

Seongho Bae

unread,
Feb 21, 2015, 3:01:01 AM2/21/15
to lav...@googlegroups.com
Dear Hyoshin,

What are you want to do with latent growth modeling?; Why are you want to use latent growth modeling?

And your raw data has just 26 cases? That is response of test of the experimental psychology experiment?

Normally, ML is not fitting with binary data well. and structural equation modeling is not fitting with very small case well. Basically, structural equation modeling will be work with over 200 cases or parameter * 10 cases as known.

Please response my questions. I'll wait you.

Seongho Bae
Master of psychology (I/O Psychology)

2015년 2월 21일 토요일 오전 6시 48분 8초 UTC+9, Hyoshin Park 님의 말:

yrosseel

unread,
Mar 13, 2015, 9:08:02 AM3/13/15
to lav...@googlegroups.com
On 02/20/2015 10:48 PM, Hyoshin Park wrote:
> When I tried to fix the dependent variable X9 to be ordered by using
> > run <- lavaan(growthCurveModel,dataset,ordered=c("X9"))
>
> I have following errors: Error in B1 %*% Delta.g : non-conformable arguments

This is because you have provided parameters for the thresholds, and you
are using the lavaan() function (which in <= 0.5.17 does not add them
automatically).

Yves.

Reply all
Reply to author
Forward
0 new messages