WebBUGS >> Main page Recent changes | Show source History | |
Built-in models:Mediation analysis | ||
---|---|---|
ModelA mediation model can be written as \[ m_i = a_0 + a_1 x_i + e_{1i} \] \[ y_i = b_0 + b_1 m_i + b_2 x_i + e_{2i} \] The mediation effect or indirect effect is \(a_1b_1\). Codemodel{ for (i in 1:N){ m[i] ~ dnorm(mum[i], pre.s1) mum[i] <- a0 + a1*x[i] y[i] ~ dnorm(muy[i], pre.s2) muy[i] <- b0 + b1*m[i] + b2*x[i] } a0 ~ dnorm(0, 1.0E-6) a1 ~ dnorm(0, 1.0E-6) b0 ~ dnorm(0, 1.0E-6) b1 ~ dnorm(0, 1.0E-6) b2 ~ dnorm(0, 1.0E-6) pre.s1 ~ dgamma(.001, .001) pre.s2 ~ dgamma(.001, .001) ab <- a1*b1 }
|
||
Powered by LionWiki. Last changed: 2014/11/11 21:45 Erase cookies | Show source History |