[R] unbalanced repeated measurements Anova with mixed effects
Thijs Muizelaar
thijs.muizelaar at xs4all.nl
Sun Oct 17 22:03:56 CEST 2010
Dear R-list members,
I've been struggling with the proper setup for analysing my data. I've
performed a route choice experiment, in which participants had to make a
choice at each junction for the next road. During the experiment they
received traffic information, but also encountered two different
accidents. They also made trips without accidents.
What I'm interested in is to see if the traffic information influenced
their route choice, regarding their total travel time, the delay and the
number of junctions they passed. These are thus three dependent variables.
The independent variables are the type of traffic information and the
accident situation, and personal characteristics such as age, gender and
amount of kilometers driven each year. In order to simplify this, I've
seperated each accident in a data frame (because the trips without
accidents, don't have all the different types of traffic information).
As far as my limited statical knowledge goes, this implies I have a
mixed repeated measurements experiment. To be able to answer the
hypotheses that traffic information influences traveltime, delay and
number of junctions, I can do an Anova. However, the datasets are also
unbalanced, because not all trips lead to the right destination.
I've found that the car package presents the proper tools to do this,
but I'm not sure if the following model will give the results I want to
have. Can anyone help me with that?
I've put the data in a wide format, where traveltime.1 stands for the
measured traveltime with traffic information 1, etc.
event1.mod.car<-lm(cbind("traveltime.1","traveltime.2","traveltime.3")~age*gender*kmyear,
data=event1.wide)
event1.aov.car<-Anova(event1.mod.car, idata=idata, idesign=~guidanceID)
Can I also use the aov function? But because of the unbalanced data,
this will probably not provide the right results. Is that right?
event1.aov<-aov(traveltime~guidanceID*gender*age*kmyear +
Error(userID/guidanceID), data=event1)
Thanks in advance!
Thijs Muizelaar
PhD student University of Twente
More information about the R-help
mailing list