Would variables' position in syntax make differences?

39 views
Skip to first unread message

Allen Wong

unread,
Apr 12, 2017, 11:55:31 PM4/12/17
to lavaan
Dear friends,

I've try the following two syntax:

model6 <- '
    #measurement model
      attacking =~ x1+x2+x3+x4+x5
      skill     =~ x6+x7+x8+x9
      movement  =~ x11+x12+x13+x14+x15
      power     =~ x16+x17+x18+x19+x20
      mentality =~ x21+x23+x24+x25
      defending =~ x27+x28+x29
      value     =~ y1+y2+y3+y4
      rating    =~ y5+y6
    #regression
      value     ~ attacking+skill+movement+power+mentality+defending+rating
      rating    ~ attacking+skill+movement+power+mentality+defending
    #residual correlations
      value     ~~ 1*value
      rating    ~~ 1*rating
'
model7 <- '
    #measurement model
      attacking =~ x1+x2+x3+x4+x5
      skill     =~ x6+x7+x8+x9
      movement  =~ x11+x12+x13+x14+x15
      power     =~ x16+x17+x18+x19+x20
      mentality =~ x21+x23+x24+x25
      defending =~ x27+x28+x29
      value     =~ y1+y2+y3+y4
      rating    =~ y5+y6
    #regression
      value     ~ skill+movement+power+mentality+defending+rating+attacking
      rating    ~ attacking+skill+movement+power+mentality+defending
    #residual correlations
      value     ~~ 1*value
      rating    ~~ 1*rating
'
fit <- sem(model7,data=data2,std.lv=F)

The only difference between two models are the position of "attacking" in #regression equation. What made me confused is that the output are exactly different.

Model6 can be fitted but model7 has an error --
Warning message:
In lavaan::lavaan(model = model7, data = data2, std.lv = F, model.type = "sem",  :
  lavaan WARNING: model has NOT converged! 

Looking forwards to some helps.

Terrence Jorgensen

unread,
Apr 13, 2017, 5:03:19 AM4/13/17
to lavaan
The only difference between two models are the position of "attacking" in #regression equation.

That is unexpected.  Could you post some data to reproduce the problem?  You could also compare the parameter tables 

PT6 <- lavaanify(model6, auto = TRUE)
PT7
<- lavaanify(model7, auto = TRUE)

By the way, this is problematic:

    #residual correlations
      value    
~~ 1*value
      rating    
~~ 1*rating

You are not specifying correlations, you are fixing residual variances to 1.  That is too restrictive because you are also fixing the first factor loading of each of those constructs to 1 (std.lv = FALSE implies that, check your parameter table or summary() output).  Since value is regressed on rating, you cannot additionally estimate a residual covariance/correlation anyway, and fixing it to a nonzero value would just attenuate the estimate of the regression slope value~rating.

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam


Allen Wong

unread,
Apr 13, 2017, 10:05:30 AM4/13/17
to lavaan
Dear Terrence,

Thanks for your reply! 

I will attach the dataset on this post. You can try to reproduce the result.

PT6 <- lavaanify(model6, auto = TRUE)
PT7 <- lavaanify(model7, auto = TRUE)

I've try this code and the outcome are as follows.
 
33   33     value  ~ attacking    1     1     1   25     NA   0        .p33.
39   39     value  ~ attacking    1     1     1   31     NA   0        .p39.




By the way, this is problematic:
    #residual correlations
      value     ~~ 1*value
      rating    ~~ 1*rating 

I've tried not to fix this two variances. But the program came to an error.



Warning message:
In lavaan::lavaan(model = model6, data = data2, std.lv = F, model.type = "sem",  :

lavaan WARNING
: model has NOT converged!

btw, when I try to add rating~~value into the syntax, it also came to an error. It is the same as above -- NOT converged!

The situation is so complex and makes me so confused. Thank you again!

Regards,

在 2017年4月13日星期四 UTC+8下午5:03:19,Terrence Jorgensen写道:
data2.xlsx

Terrence Jorgensen

unread,
Apr 17, 2017, 10:27:31 AM4/17/17
to lavaan
Indeed, you are freely estimating the same parameters in both models:

fit6 <- sem(model6, data=data2, std.lv = TRUE)
fit7
<- sem(model7, data=data2)
all
(sort(names(coef(fit6))) ==sort(names(coef(fit7))))

I still don't understand why changing the order of estimated parameters would change convergence, but I think that might just be a coincidence.  You said model6 can be estimated fine, but that came with warnings about Heywood cases, and when you identify the model by fixing factor variances instead of factor loadings, both models converge but cannot estimate SEs.  If you look at your standardized solution for model 6, you will see many correlations beyond 1 and negative variances, as well as extremely poor fit.  

summary(fit6, std = TRUE, fit = TRUE)

Inspecting your data gives you some clues as to why your model is so inappropriate.  

round(cor(data2[lavNames(fit6)]), digits = 2)

For example, the indicators of attacking correlation more highly with some indicators of skill than with each other, and that will cause factor correlations to skyrocket to try and compensate.  Also, x3 looks like it should be reverse-coded to go in the same direction as the other indicators.  With a mix of positive and negative factor correlations, having a negative factor loading might cause some trouble on its own, even in a model that at least approximates the data-generating process.

I've tried not to fix this two variances. But the program came to an error.

That is a problem, because your model should be identified just with the fixed factor loadings.  If a model fits very poorly, the optimizer may never find a "best" solution because no good one exists.
Reply all
Reply to author
Forward
0 new messages