[R-sig-ME] design of nested mixed effects model with repeated measures

Andrew Dolman andydolman at gmail.com
Fri Dec 24 17:45:57 CET 2010

Hello Anna,

My first reaction on reading this was that your random effects
structure is far too complicated. In fact, I'm not sure you need to be
using mixed effects models at all.

> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/fire/patch/replicate)

There are a few issues I can see:

Fire is not nested in block at all, it is crossed, and it is not
random either. So fire should go from your random effects structure.

> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/patch/replicate)

Patch is not random either and even if it were it only has 2 levels
and so cannot properly be fit as random. It's also crossed with block
and with fire. (It's also a confusing name. Consider calling it
habitat, or canopy(T,F))

> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/replicate)

Replicate is nested in block but if treated as such should be coded as
1:12 rather than 1:3 inside fire. Also a good idea to make the coding
explicit that the reps are in different patches so A1-A12, B1-B12 etc.

> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/replicate)  # recode replicate so that they are unique

Date depends a bit on whether you are treating is as a factor or as a
continuous variable. However, either way it is crossed with everything

> model1_lme<-lme (y~patch*date*fire ,random=~date|block/replicate)  # if date is a continuous variable
> model1_lme<-lme (y~patch*date*fire ,random=~1|block/replicate)  # if date is factor

The other consideration is that to fit a random variable you really
need at least 5 levels and block only has 3.

Christmas is about to officially start apparently, so I'm off.


andydolman at gmail.com

On 24 December 2010 01:22,  <Anna.Richards at csiro.au> wrote:
> Hello,
> I am having a lot of difficulty specifying a mixed effects model structure for analysing some soil nutrient data. I have been reading a lot about mixed effects models from books and the R mailing lists and I thought I had my design sorted until I had some feedback from reviewers that suggested otherwise. My design is as follows:
> I have collected data from a fire experiment which has a randomised block design. There are three blocks of vegetation and each block is separated into 4 plots that get burnt at 4 different frequencies. I sampled soil from each of these 12 plots, however, I stratified my sampling by tree cover ('patch'). That is, I took 3 samples from beneath tree canopies and 3 samples away from canopies in each plot (the samples were actually composite samples made from bulking 8 individual soil samples collected over a 2 x 2m grid). I performed this sampling directly after the experimental burns were undertaken and at a further 4 other time points (2 weeks, 1 month, 3 months, 5 months) after the fires. At each time point I made sure that soil samples were collected a small distance away from the previous collections, but still  beneath the same canopy conditions.
> Fire: factor with 4 levels: 1,2,5,0
> Block: factor with 3 levels: A, B, C
> Patch: factor with 2 levels: T, I
> Replicate: factor with 3 levels: 1, 2, 3
> Date (time since fire): 1, 12, 28, 55, 152
> Total number of observation: 359 (one missing observation)
> Response: soil amino acid concentration
> Fixed effects: patch, date, fire
> I wanted to treat block as a random effect and then because replicate samples taken from each patch type are nested within fire treatments I designed my random effects as block/fire/patch/replicate. However, because I took samples at different dates I wanted to account for the fact that samples collected from one time point are more closely related than samples collected at another time point. I also checked that there was no auto-correlation in my residuals using the corSpher correlation function (ie. that samples taken closer together e.g. days 1 and 12 are more highly correlated than samples taken further apart e.g. days 1 and 155) and I didn't find this to be a problem. The main difference of opinion has been where to place the 'date' term in the random effects. My original design was:
> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/fire/patch/replicate)
> but it was suggested that I should instead use:
> model1_lme<-lme (y~patch*date*fire ,random=~1|block/fire/patch/replicate/date)
> or
> model1_lme<-lme (y~patch*date*fire ,random=~1|date/block/fire/patch/date/replicate)
> Both these alternative models don't make sense to me but I am very new to mixed models so perhaps they are correct? Additionally, I understand that this group uses lmer and perhaps that is what I need to start using for these complicated designs? Lastly, I tried including date as a random covariate: random =~date|block/fire/patch/replicate but I receive the error:
> Error in logLik.lmeStructInt(lmeSt, lmePars) :
>  NA/NaN/Inf in foreign function call (arg 3)
> In addition: There were 50 or more warnings (use warnings() to see the first 50)
>> warnings()
> Warning messages:
> 1: In logLik.lmeStructInt(lmeSt, lmePars) :
>  Singular precision matrix in level -2, block 1
> Etc
> Any suggestions would be much appreciated, we don't have any statistics support in my lab so I feel very much in the dark when it comes to these things.
> Thanks!
> Anna
> Dr Anna Richards
> OCE Postdoctoral Fellow
> CSIRO Ecosystem Sciences
> Darwin, Australia
> Dr Anna Richards
> OCE Postdoctoral Fellow
> CSIRO Ecosystem Sciences
> Phone: +61 8 89448437 | Fax: +61 8 89448444 | Mobile: 0423 971 997
> anna.richards at csiro.au<mailto:anna.richards at csiro.au> | www.csiro.au | www.csiro.au/people/Anna.Richards.html
> Address: CSIRO Tropical Ecosystems Research Centre, 564 Vanderlin Drive, Berrimah NT 0828 Australia. (Postal address: PMB 44, Winnellie NT 0822)
> The information contained in this email may be confidential or privileged. Any unauthorised use or disclosure is prohibited. If you have received this email in error, please delete it immediately and notify the sender by return email. Thank you. To the extent permitted by law, CSIRO does not represent, warrant and/or guarantee that the integrity of this communication has been maintained or that the communication is free of errors, virus, interception or interference.
> Please consider the environment before printing this email.
>        [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

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