Dear List,

My name is Daniel Anderson and I’m a PhD student in the college of education at the University of Oregon. I apologize in advance for the length of my question. I’m writing to ask for some advice on a model I’m fitting. The data include a set of repeated measures (9) taken by students over the course of three years (3 data points per year). The teacher students were instructed by for each year is also included. I’d like to model students’ growth in each year, while parceling the summer period, and evaluate the variance of students’  growth at the teacher level. I thus created three “clock” variables--one for each year--and two “transition” variables denoting the time at which students began a new grade. The coding of time followed the recommendations of Singer and Willett (2003), so the intercept should represent students' initial achievement during the first year of the study (Grade 3), while the transition variables essentially represent a new intercept for the corresponding grade (i.e., intercept adjustment). A sample of the data structure is displayed below. I’ve also attached code at the end of this message to simulate the data structure.

   SID Occasion  TID    Score Grade s3 s4 s5 trans4 trans5
1    1      f10 	1033 152.3866     3  0  0  0      0      0
2    1      w11 	1033 160.4187     3  1  0  0      0      0
3    1      s11 	1033 173.1166     3  2  0  0      0      0
4    1      f11 	1037 160.2427     4  2  0  0      1      0
5    1      w12 	1037 174.8625     4  2  1  0      1      0
6    1      s12 	1037 198.8840     4  2  2  0      1      0
7    1      f12 	1055 181.2170     5  2  2  0      1      1
8    1      w13 	1055 197.1830     5  2  2  1      1      1
9    1      s13 	1055 194.9400     5  2  2  2      1      1
10  10      f10 	1031 150.0266     3  0  0  0      0      0
11  10      w11	1031 165.4996     3  1  0  0      0      0
12  10      s11 	1031 184.8826     3  2  0  0      0      0
13  10      f11 	1039 171.6536     4  2  0  0      1      0
14  10      w12 	1039 165.5924     4  2  1  0      1      0
15  10      s12 	1039 168.8774     4  2  2  0      1      0
16  10      f12 	1052 179.4955     5  2  2  0      1      1  
…

I’d like to estimate a model where students' intercept and third grade slope (s3) vary by _only_ their 3rd grade teacher, while the intercept adjustment for Grade 4 (trans4) and slope for Grade 4 (s4) vary only by their 4th grade teacher, etc. In other words, I don’t want students third grade slope to vary by their fourth or fifth grade teachers (given the temporal discordance). I’m not sure how to do that with the way the data are structured, as displayed above. I did try appending the teacher id for each year to the data, as below, but I wasn’t sure if that was appropriate.

   SID Occasion  TID    Score Grade s3 s4 s5 trans4 trans5 TID11 TID12 TID13
1    1      f10 	1033 152.3866     3  0  0  0      0      0  1033  1037  1055
2    1      w11 	1033 160.4187     3  1  0  0      0      0  1033  1037  1055
3    1      s11 	1033 173.1166     3  2  0  0      0      0  1033  1037  1055
4    1      f11 	1037 160.2427     4  2  0  0      1      0  1033  1037  1055
5    1      w12 	1037 174.8625     4  2  1  0      1      0  1033  1037  1055
6    1      s12 	1037 198.8840     4  2  2  0      1      0  1033  1037  1055
7    1      f12 	1055 181.2170     5  2  2  0      1      1  1033  1037  1055
8    1      w13 	1055 197.1830     5  2  2  1      1      1  1033  1037  1055
9    1      s13 	1055 194.9400     5  2  2  2      1      1  1033  1037  1055
10  10      f10 	1031 150.0266     3  0  0  0      0      0  1031  1039  1052
11  10      w11 	1031 165.4996     3  1  0  0      0      0  1031  1039  1052
12  10      s11 	1031 184.8826     3  2  0  0      0      0  1031  1039  1052
13  10      f11 	1039 171.6536     4  2  0  0      1      0  1031  1039  1052
14  10      w12 	1039 165.5924     4  2  1  0      1      0  1031  1039  1052
15  10      s12 	1039 168.8774     4  2  2  0      1      0  1031  1039  1052
16  10      f12 	1052 179.4955     5  2  2  0      1      1  1031  1039  1052

With this data structure, I could fit a model of the form
--
m0.1<-lmer(Score ~ s3 + s4 + s5 + trans4 + trans5 + 
				(s3 + s4 + s5 + trans4 + trans5 | SID) +
				(1 + s3 | TID11) + 
				(0 + trans4 + s4 | TID12) + 
				(0 + trans5 + s5 | TID13) 
				,data=ldta,verbose=2)
----
But this model (in addition to potentially being inappropriate) forces the effects between years to be independent, when I really want them to be somewhat cumulative, and weighted based on the “effect” of the previous year’s teacher (i.e., Grade 3 teacher residual impacts the students’ Grade 4 growth). In other words, I want to estimate the “persistence” of the effects. 

I believe my data have what some have referred to as a sequential multiple membership structure, as the students’ teacher membership changes over time. I’ve seen some discussion on multiple membership models on this list previously (e.g., https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q2/016527.html), but I’m not sure it’s directly applicable to my situation because I don’t have known weights I can apply (but perhaps I’m not thinking about it correctly).

I’d really appreciate any thoughts, advice, suggestions for resources, etc. The issue has been vexing me.


#########Simulate Data 
set.seed(1234)
t11 <- data.frame(TID11 = rep(1020:1039, rep(30,20)))
	t11$rand <- rnorm(nrow(t11))
	t11 <- t11[order(t11$rand),]
t12 <- data.frame(TID12 = rep(1020:1039, rep(30,20)))
	t12$rand <- rnorm(nrow(t12))
	t12 <- t12[order(t12$rand),]
t13 <- data.frame(TID13 = rep(1040:1059, rep(30,20)))
	t13$rand <- rnorm(nrow(t13))
	t13 <- t13[order(t13$rand),]
		
simData<-data.frame(
			#Student IDs
			SID = factor(1:600),
			#Teacher IDs
			TIDf10 = t11$TID11,
			TIDw11 = t11$TID11,
			TIDs11 = t11$TID11,
			TIDf11 = t12$TID12,
			TIDw12 = t12$TID12,
			TIDs12 = t12$TID12,
			TIDf12 = t13$TID13,
			TIDw13 = t13$TID13,
			TIDs13 = t13$TID13,			
			#Scores
			f10 = rnorm(600, 159.05, 12.52),
			w11 = rnorm(600, 169.30, 12.73),
			s11 = rnorm(600, 177.93, 12.50),
			f11 = rnorm(600, 174.55, 11.46),
			w12 = rnorm(600, 183.34, 11.15),
			s12 = rnorm(600, 191.29, 11.90),
			f12 = rnorm(600, 189.24, 11.59),
			w13 = rnorm(600, 196.91, 11.67),
			s13 = rnorm(600, 204.52, 11.97)
			)

ldta<-reshape(simData,
			idvar = "SID",
			varying = list(c(2:10),c(11:ncol(simData))),
			v.names = c("TID","Score"),
			times = c("f10","w11","s11","f11","w12","s12","f12","w13","s13"),
			timevar = "Occasion",
			direction = "long")		
rownames(ldta)<-NULL
ldta<-ldta[order(ldta$SID),]

#Create Grade Variable (for reference purposes)
ldta$Grade<-ifelse(ldta$Occasion == "f10"| 
				   ldta$Occasion == "w11"|
				   ldta$Occasion == "s11",3,ifelse(
				   ldta$Occasion == "f11"| 
				   ldta$Occasion == "w12"|
				   ldta$Occasion == "s12",4,ifelse(
				   ldta$Occasion == "f12"| 
				   ldta$Occasion == "w13"|
				   ldta$Occasion == "s13",5,NA)))

#Code piecewise slopes
ldta$s3<-rep(c(0,1,2,2,2,2,2,2,2),600) #Grade 3
ldta$s4<-rep(c(0,0,0,0,1,2,2,2,2),600) #Grade 4
ldta$s5<-rep(c(0,0,0,0,0,0,0,1,2),600) #Grade 5

#Dummy vectors for each grade-level transition
ldta$trans4<-rep(c(0,0,0,1,1,1,1,1,1)) #Transition to 4th grade
ldta$trans5<-rep(c(0,0,0,0,0,0,1,1,1)) #Transition to 5th grade

Thanks,
--
Daniel Anderson
Research Assistant
Behavioral Research and Teaching
University of Oregon











	[[alternative HTML version deleted]]

