[R] two indirect effects of path analysis
yrosseel
yrosseel at gmail.com
Sun Oct 7 10:10:29 CEST 2012
On 10/07/2012 02:17 AM, Elaine Kuo wrote:
> Hello,
>
> This is Elaine.
>
> I am trying a path analysis using lavaan Package.
>
> There are three explanatory variables: X, Z, and M.
> The response variable is Y.
> A, b, and c have direct effects on Y.
>
> On the other hand, X and Z also have direct effects on M.
> In other words, X and Z have indirect effects on Y.
>
> I found the code example of lavaan package describes only one indirect
> effect as below.
> Please kindly advise how to modify it as two indirect effects.
You need to write down all the regressions that are involved in your
model. For each 'dependent' variable, there is a regression formula:
model <- '
Y ~ X + Z + M
M ~ X + Z
'
Optionally, you can label the parameters, and define some indirect effects:
model <- '
Y ~ c1*X + c2*Z + b*M
M ~ a1*X + a2*Z
ab1 := a1*b
ab2 := a2*b
totalx := ab1 + c1
totalz := ab2 + c2
'
Hope this helps,
Yves.
More information about the R-help
mailing list