Am I specifying my lmer model correctly ?
Say I have one independent variable (X) at individual level and one independent variable (Z) at group level. Both are continuous variable . If the model is
\(Y_{ij}=\gamma_{00}+\gamma_{10}X_{ij}+\gamma_{01}Z_{j}+\gamma_{11}X_{ij}Z_{j}+u_{1j}X_{ij}+u_{0j}+e_{ij}\)
where \(Y_{ij}\) is the score of individual \(i\) in group \(j\) on the dependent variable ;
\(X_{ij}\) is the score of individual \(i\) in group \(j\) on the independent variable on the individual level ;
\(Z_{j}\) is the score of group \(j\) on the independent variable on the group level ;
\(\gamma_{00}\) is the general intercept ;
\(\gamma_{10}\) is the regression coefficient of the direct effect of \(X_{ij}\) on \(Y_{ij}\) ;
\(\gamma_{01}\) is the regression coefficient of the effect of \(Z_{j}\) on \(Y_{ij}\) ;
\(\gamma_{11}\) is the regression coefficient of the effect of \(Z_{j}\) on the influence of \(X_{ij}\) on \(Y_{ij}\)
\(e_{ij}\) is the error term on the individual level ;
\(u_{0j}\) is the error term on the group level in the intercept ;
\(u_{1j}\) is the error term on the group level in the effect of \(Z_{j}\) on the influence of \(X_{ij}\) on \(Y_{ij}\) .
Then using "lmer" syntex will the model be
where `group` is another variable in the data frame to indicate in which group the individual belongs to ?
or the model is
Thanks & Regards .
Say I have one independent variable (X) at individual level and one independent variable (Z) at group level. Both are continuous variable . If the model is
\(Y_{ij}=\gamma_{00}+\gamma_{10}X_{ij}+\gamma_{01}Z_{j}+\gamma_{11}X_{ij}Z_{j}+u_{1j}X_{ij}+u_{0j}+e_{ij}\)
where \(Y_{ij}\) is the score of individual \(i\) in group \(j\) on the dependent variable ;
\(X_{ij}\) is the score of individual \(i\) in group \(j\) on the independent variable on the individual level ;
\(Z_{j}\) is the score of group \(j\) on the independent variable on the group level ;
\(\gamma_{00}\) is the general intercept ;
\(\gamma_{10}\) is the regression coefficient of the direct effect of \(X_{ij}\) on \(Y_{ij}\) ;
\(\gamma_{01}\) is the regression coefficient of the effect of \(Z_{j}\) on \(Y_{ij}\) ;
\(\gamma_{11}\) is the regression coefficient of the effect of \(Z_{j}\) on the influence of \(X_{ij}\) on \(Y_{ij}\)
\(e_{ij}\) is the error term on the individual level ;
\(u_{0j}\) is the error term on the group level in the intercept ;
\(u_{1j}\) is the error term on the group level in the effect of \(Z_{j}\) on the influence of \(X_{ij}\) on \(Y_{ij}\) .
Then using "lmer" syntex will the model be
Code:
lmer(Y~X+Z+(1|group)+(0+X|Z) ,data=d)
or the model is
Code:
lmer(Y~X+Z+(1|group)+(0+X|group) ,data=d)
Last edited: