I have a dataset with the following variables:
- Treatment : (fixed,3 levels)
- Location : (fixed, 4 levels)
- Sample (random, 5 levels): 5 samples are taken in each location (randomly)
- Subsample (random - 3 levels): 3 subsamples are taken in each sample. One treatment is assigned (randomly) to one of the subsample.
The study was conducted every Wednesday during 15 weeks in 2013, from week 32 to week 47 (no observations for week 33).
For the first location, samples are taken week 32, 36, 39, 42 and week 49.
For the second location, samples are taken week 46
For the third location, samples are taken week 35, 38, 41, 44
For the 4th location, samples are taken at week 34, 37, 40, 43, 47.
For each location i, week j(i), sample k(ij), and treatment l, the weight of the subsample has been recorded.
The aim of the study is to see if there is an effect of the factor treatment on the weight.
I am new in mixed effect model so I am reading the book "Mixed effects Models in S and S-plus" from Pinheiro & Bates, but I still have some doubts on how to treat the different variables (random, fixed, nested).
I would like to use the lme function from the nlme package. I think the formula will look like this :
weight ~ treatment , random = ~ 1| location/week/sample
So I consider that
- sample is nested in week
- week is nested in location
Is my model correct?
Thank you for you help