I’m working with data from a learning experiment in birds and I have some doubts I hope you can help me clarify. I'm interested in comparing the performance in a learning task between male and female birds. We measured the percentage of correct responses for 6 females and 5 males along 6 different days (=sessions), i.e. we have repeated measures along time for each subject. The data looks like this (the percentage of correct responses for each session was arcsin transformed to normalize data = resp):
Ind sex session resp
1 F 1 1.284
1 F 2 1.318
1 F 3 1.231
1 F 4 1.209
1 F 5 1.150
1 F 6 1.571
2 F 1 1.571
2 F 2 1.571
2 F 3 0.955
2 F 4 0.685
2 F 5 1.571
2 F 6 1.130
3 M 1 1.384
3 M 2 1.571
3 M 3 1.231
.. .. .. ..
.. .. .. ..
So, the question I’m trying to answer is if there are differences in learning between males and females. I was planning to use a mixed model to evaluate differences between sexes, where:
Dependent variable: percentage of correct responses for each session (arcsin transformed to normalize data) = resp
Fixed effects: sex, session and their interaction
Random effect: subject ID
This is my code:
sex<-as.factor(retcolor$sex)
ind<-as.factor(retcolor$ind)
session<-as.factor(retcolor$session)
resp<-as.numeric(retcolor$resp)
Model.1<-lme(resp~sex*session, data=retcolor, random=~1|ind, method="REML")
summary(Model.1)
Linear mixed-effects model fit by REML
Data: retcolor
AIC BIC logLik
26.20109 38.9639 -7.100546
Random effects:
Formula: ~1 | ind
(Intercept) Residual
StdDev: 0.03248164 0.2364255
Fixed effects: resp ~ sex * session
Value Std.Error DF t-value p-value
(Intercept) 1.5339778 0.09082871 53 16.888688 0.0000
sexM -0.0336711 0.13472075 9 -0.249933 0.8083
session -0.0549619 0.02307276 53 -2.382112 0.0208
sexM:session -0.0256210 0.03422244 53 -0.748659 0.4574
Correlation:
(Intr) sexM sessin
sexM -0.674
session -0.889 0.599
sexM:session 0.599 -0.889 -0.674
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.62037068 -0.57627675 -0.07498751 0.65682708 2.00819167
Number of Observations: 66
Number of Groups: 11
anova(Model.1)
numDF denDF F-value p-value
(Intercept) 1 53 1752.8207 <.0001
sex 1 9 4.0007 0.0765
session 1 53 15.2789 0.0003
sex:session 1 53 0.5605 0.4574
Do you think I’m going in the right direction?
My main doubt is about the random effect: is it OK like I wrote it?: random=~1|ind
.
This means this a random intercept model, right? Or should I use a random slopes model? (this is where I get lost).