I am in the midst of analyzing data that I thought were rather simplistic, but I find myself in need of guidance. The function lmer() has been suggested, but I'm unclear about groups to be included when identifying random effects despite consulting every resource I could get my hands on. I think I know just enough about R to get myself into trouble, so please accept my apologies in advance if this should be obvious!
The design: Three blocks [to which experimental units & treatments were randomly assigned], each containing every combination of 3 species (spp) and 4 treatments (trt). Response (PN) was measured weekly for 10 weeks (Week). I expect the species will differ, so - to simplify - I am running a separate model for each species. Within each of the spp x trt "tubs", I have three units which allowed a mean response (meanPN) and variance (varPN), so I'm using meanPN as my response and will weight the model by 1/varPN.
my model:
meanPN ~ Trt + Block + Time (+ interactions) + error
maybe the statement (excluding interactions for now as I try to wrap my mind around this) would be:
lmer(meanPN ~ Trt + (Trt|Week) + (1|Block) , data=SumExpt, weights=1/varPN)
Can you help me to understand why I would use (1|Week) versus (Trt|Week) - or perhaps, when would each case be appropriate?
Also, does one need to identify Week as the repeated variable, or is R interpreting that based on the pipe character?
Finally, if I understand what I've read correctly, the interactions are handled in the denominators calculating the F-statistic. Is that proper understanding?
lmefrom packagenlme. – Roland Nov 2 '12 at 8:07