[R-sig-ME] Running repeated measures in lme4

Emma Stone Emma.Stone at bristol.ac.uk
Wed Mar 3 15:01:15 CET 2010

Hi Everyone,

Thanks for your replies in response:

Yes my data are

site	treatment		minutes
1	1			15
1	2			16
1	3			60
1	4			35
2	1			
2	2
2	3
2	1


Regards the repeated measures element: although I only have one replicate 
of each treatment level, the subject is site and at each site I repeatedly 
measured the response across treatments, treatments 1-4 were sequentially 
measured on each subject.

Regards using the model1<-lmer~(minutes~treatment+(1|site), data = data)

"The intercept value for the response is allowed to vary randomly between 
sites - the unit that has been measured repeatedly. ". Forgive me for 
sounding stupid, but I am not sure that I really understand this, if this 
is the site level variation in the intercept of the response, isnt this my 
group level effect regardless of treatment? If so how can it be accounting 
for the repeated measures, as the repeated measures are treatments within 

I am not interested in the between sites differences in intercepts - 
overall site level effects in themselves, i.e. I don't care if there is a 
difference between sites in terms of intercept, as I would expect there to 
be as they are a random selection of sites, which all start with different 
actual values.

I am interested in how the response changes between treatments within site 
- and whether this pattern (slope) is the same across sites. So I 
understand that I am after the within subject effects of treatment across 
sites, therefore - whether the effect of treatment is the same across sites 
(the slope), if it significantly different between sites, there is no 
overall effect of treatment.

I then would want to conduct post hocs to test which treatment levels are 
significantly different from each other.

I have run this model (from the same design) with a different data set in 
SPSS and it runs fine, there are enough degrees of freedom as I have 4 
treatments and 8 sites.

I tried using a poisson model because I used the unlogged data.



--On 03 March 2010 14:24 +0100 "Andy Fugard (Work)" <andy.fugard at sbg.ac.at> 

> Emma Stone wrote:
>> Hi Ben,
>> Thanks for your reply, however I have re ran this and I still get zero
>> group variance. Also, forgive my ignorance but doesn't this code remove
>> the repeated measures element of the design? Also for note, I ran my
>> code with a poisson distribution and I did get variance outputs for the
>> Random Group level.
> Would be helpful to know more about the dataset, maybe use "head" to get
> the first few rows.  Does it look like this?
>   site   treatment    minutes
>   1      1
>   1      2
>   1      3
>   1      4
>   2      1
>   2      2
>   2      3
>   2      4
>   ...
>   8
>   8
>   8
>   8
> Also what was the whole summary output.
> Have you tried this?
>   xyplot(minutes ~ treatment|site)
> Is it possible that there is no variation between sites?
> /A
>> Emma
>> --On 03 March 2010 07:28 -0500 Ben Bolker <bolker at ufl.edu> wrote:
>>> Emma Stone wrote:
>>>> Dear all,
>>>> I wander if you can help.
>>>> I am running a repeated measures model with lmer.I have 8 sites, at
>>>> each I  conducted an experiment with treatments which have 4 levels.
>>>> Each treatment  was conducted only once per site, but each site has
>>>> one of each of the  treatment levels so it is balanced. Obviously the
>>>> treatments within sites  are the repeated measures component, and I
>>>> want to look at differences  between treatments within sites, I am not
>>>> really interested in the site  group effect but need to incorporate
>>>> it. So I have set up my model as  follows:
>>>> model1<-lmer~(minutes~treatment+(treatment|site), data = data)
>>>   This model fits a site by treatment interaction, which you don't
>>> have enough information for since you don't have replication.  I believe
>>> you want
>>> model1<-lmer~(minutes~treatment+(1|site), data = data)
>>> --
>>> Ben Bolker
>>> Associate professor, Biology Dep't, Univ. of Florida
>>> bolker at ufl.edu / people.biology.ufl.edu/bolker
>>> GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
>> ----------------------
>> Emma Stone
>> Postgraduate Researcher
>> Bat Ecology and Bioacoustics Lab
>> & Mammal Research Unit
>> School of Biological Sciences,
>> University of Bristol, Woodland Road,
>> Bristol, BS8 1UG
>> Email: emma.stone at bristol.ac.uk
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> --
> Andy Fugard, Postdoctoral researcher, ESF LogICCC project
> "Modeling human inference within the framework of probability logic"
> Department of Psychology, University of Salzburg, Austria
> http://www.andyfugard.info

Emma Stone
Postgraduate Researcher
Bat Ecology and Bioacoustics Lab
& Mammal Research Unit
School of Biological Sciences,
University of Bristol, Woodland Road,
Bristol, BS8 1UG
Email: emma.stone at bristol.ac.uk

More information about the R-sig-mixed-models mailing list