[R-sig-ME] longitudinal analysis when one group switched from control to treatment
@|m@h@rme| @end|ng |rom gm@||@com
Sun May 17 01:09:17 CEST 2020
I have a 3-year longitudinal dataset (*see link below the table*). Up to
year 2 (coded "1"), 8 schools (4 in Treatment, 4 in Control) cooperated
with the study. But in year 3 (coded "2"), one of the Treatment schools
(named "good") dropped out.
Also in year 3 (coded "2"), we were made to move one of the *Control *schools
(named "*orange*") to the *Treatment *group. The full design of the study
is shown in the Table below.
I want to regress "year" and "group" on "y" (a continuous response) in lme4
package in R. But is there a way to capture the switch of one of the
control schools to the treatment group?
Thank you very much, Simon
· *Switched from control to treatment*
· *Out as of year coded 2*
*dat <- read.csv('https://raw.githubusercontent.com/hkil/m/master/z.csv
*m1 <- lmer(y~ year*group + (1|stid), data = dat) #### 'stid' =
student id m2 <- lmer(y~ year*group + (1|scid/stid), data =
dat) #### 'scid' = school id*
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models