Dear David, R-sig-mixedmodels is a better mailing list for this kind of question.
1) yes 2) use (Treatment | Random_Assignment_Block) instead of (1 | Random_Assignment_Block) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2016-01-29 7:10 GMT+01:00 David Roy <dmr02...@gmail.com>: > 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@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.