Correlated disturbances in model - how do we handle it in R lavaan

447 views
Skip to first unread message

Sheila Roy

unread,
Nov 9, 2014, 8:38:52 AM11/9/14
to lav...@googlegroups.com
Hi!

I am analyzing a model in which  the disturbances are correlated. How do wehandle the model specification of such a model in lavaan.

Also, In Yves Rosseel's paper on lavaan, the covariances between observed variables are called as 'residual covariances'. For example

# residual variances observed variables
+ x1 ~~ x1
+ x2 ~~ x2
+ x3 ~~ x3
+ x4 ~~ x4
+ x5 ~~ x5

How do we included correlation between disturbances or residuals in the lavaan model specification?

Cheers
Sheila

Edward Rigdon

unread,
Nov 9, 2014, 11:04:32 AM11/9/14
to lav...@googlegroups.com
Sheila--
     If y1 and y2 are dependent on something (a factor, or other observed variables), then the syntax:

y1 ~~ y1

refers to the residual variance of y1, and the syntax:

y1 ~~ y2

refers to residual covariance, or covariance between the residuals, for y1 and y2.

--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.

Sheila Roy

unread,
Nov 11, 2014, 2:11:41 AM11/11/14
to lav...@googlegroups.com
Thanks Edward! Much appreciate it.

If you could help a bit more. I have attached the path model. X and Ys are obsserved variables for me. The Ds are disturbances or residuals which are correlated with one another. How do I model this in Lavaan?

Cheers
Sheila
Path model diagram.pdf

kma...@aol.com

unread,
Nov 12, 2014, 9:17:36 AM11/12/14
to lav...@googlegroups.com
Sheila,
Is this what you want?

RC.mod.sim <- '
x11~~1*x11
x12~~1*x12
x13~~1*x13
x21~~1*x21
x22~~1*x22
x23~~1*x23
y1~~.5*y1
y2~~.5*y2
y3~~.5*y3
y1~1*x11+1*x12+1*x13
y2~1*x21+1*x22+1*x23+1*y1
y3~1*y1+1*y2
y1~~.25*y2
y2~~.25*y3
y1~~.25*y3'

RC.mod.est <- '
y1~~y1
y2~~y2
y3~~y3
y1~x11+x12+x13
y2~x21+x22+x23+y1
y3~y1+y2
y1~~y2
y2~~y3
y1~~y3'

RC.df <- simulateData(model=RC.mod.sim)
RC.fit <- lavaan(model=RC.mod.est, data=RC.df)
inspect(RC.fit, 'free')
summary(RC.fit)

Keith
------------------------
Keith A. Markus
John Jay College of Criminal Justice, CUNY
http://jjcweb.jjay.cuny.edu/kmarkus
Frontiers of Test Validity Theory: Measurement, Causation and Meaning.
http://www.routledge.com/books/details/9781841692203/


Sheila Roy

unread,
Nov 17, 2014, 2:30:34 AM11/17/14
to lav...@googlegroups.com
Keith...Thank you so much for this. I have been trying to learn path analysis and SEM at the same time as Lavaan for the past few days and hence delayed my response.

Could you explain why its necessary to do the steps under RC.mod.sim.  

Could you clarify  why do we need to introduce 0.5 in the variance of y1  (y1~ 0.5y1 - why the need to introduce 0.5 y1) and subsequently 0.25  in the covariance between y1 and y2.

Best regards
Sheila


e we 

yrosseel

unread,
Nov 27, 2014, 2:10:13 PM11/27/14
to lav...@googlegroups.com
On 11/11/2014 08:11 AM, Sheila Roy wrote:
> Thanks Edward! Much appreciate it.
>
> If you could help a bit more. I have attached the path model. X and Ys
> are obsserved variables for me. The Ds are disturbances or residuals
> which are correlated with one another. How do I model this in Lavaan?

model <- '

# regressions
y1 ~ x11 + x12 + x1i
y2 ~ y1 + x21 + x22 + x2k
y3 ~ y1 + y2

# correlated disturbances
y1 ~~ y2
y1 ~~ y3
y2 ~~ y3
'

Yves.

Sheila Roy

unread,
Nov 27, 2014, 10:39:41 PM11/27/14
to lav...@googlegroups.com
Thank you Yves. Much appreciate this.

Cheers
Sheila



--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/ol-PjW-s7Pk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages