[R] Multilevel Modeling in R

Bert Gunter bgunter.4567 at gmail.com
Fri Jan 29 23:45:47 CET 2016


1. Please post in plain text, not HTML, which can get garbled.

2. I believe your syntax is incorrect, but I haven't used lmer in a
while, and so what I believe should be ignored anyway. HOWEVER, there
is a SIG (special interest group) for mixed models, and you have a
much better chance of getting reliable advice on such matters there.
So you should sign up and post to R-sig-mixed-models on these topics
rather than here.

Cheers,
Bert





Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jan 28, 2016 at 10:10 PM, David Roy <dmr02004 at gmail.com> wrote:
> I am conducting a multilevel regression analysis on the effect of an
> intervention on student test results, and am not sure how to implement the
> necessary R code to correctly capture the nested structure.
>
>
>
> The outcome measure for the study is whether a student passed or failed a
> final exam.  The structure of the data is students nested within schools,
> and then schools nested within random assignment blocks.  Treatment (i.e.,
> the intervention) was implemented at the school-level.  The covariates that
> I am planning to use are prior year test scores (this is also a binary
> variable for pass or fail), race, and gender.
>
>
>
> My ideal output would show the impact of the treatment for each of the
> random assignment blocks, and then the weighted average of the impact
> across all of the random assignment blocks.
>
>
>
> Based on my research thus far, it seems like the **lmer** function from the
> **lme4** package would be the best route to go.
>
>
>
> This is the code that I have tried:
>
>
>
>     # Fit multilevel regression with random assignment blocks
>
>     glmer2 <- glmer(Post_Test_Score ~ Treatment +
>
>                                       Pre_Test_Score +
>
>                                       (1 | School) +
>
>                                       (1 | Random_Assignment_Block),
>
>                     data = StudyData,
>
>                     family = binomial("logit"))
>
>
>
> My two questions are the following:
>
>
>
> 1.) Given the nested structure of my data, would the above regression
> output the correct coefficient for the impact of treatment across all
> random assignment blocks?
>
>
>
> 2.) How would I code the interaction effect between Treatment and
> Random_Assignment_Block in order to generate separate impact estimates for
> each of the random assignment blocks?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list