# Repeated, Spatial & Temporally Nested Design Confirmation

I'm an ecology grad student struggling to confirm proper analysis for the following experimental design:

I identified 3 spatial blocks, each containing the same 3 plant types (tree, grass, shrub). There was only a single representative of each plant type within each block (9 representatives total). I measured %nitrogen of leaf tissue 10 times (date) with an irregular frequency on the same representatives.

I am interested in the plant type effect & the interaction effect of plant type & date. I would like to know if there was an effect of block and/or date. I include subject to account for its respective variation.

I believe the following model would be appropriate:

%nitrogen ~ (1|Block) + (1|Block:Subject) + (1|Date) + Vegetation + (1|Vegetation:Date)

...such that %nitrogen = response; Vegetation = fixed factor; & Block, Subject, & Date are random factors (as well as all interactions containing a random factor)

Is my nesting appropriate? Are my factor designations for "random"/"fixed" appropriate?

• What exactly did you measure (what is the response) , what is each Subject and how many subjects are there ? – Robert Long Aug 3 '16 at 18:21
• Can you describe your random effect specification in words rather than with an R formula? I think your formula is wrong, but I don't know if your reasoning is wrong. You say the date was irregular. You mean there were uneven intervals of date, but all 9 plants were measured at the same time for each of the 10 dates? – AdamO Aug 3 '16 at 18:45
• @RobertLong I measured %nitrogen of leaf tissue as a response. Subject refers to an individual plant. Each block contained only 1 individual of each plant type, for a total of 9 subjects among the 3 blocks. – Aaron Macy Aug 4 '16 at 14:55
• @AdamO There were uneven intervals of date, correct. All 9 plants were measured at the same time for each of the 10 dates, also yes. I think the random/fixed designation depends on my specific questions. I see it as a covariate; I would like to confirm its significance, but I am particularly interested as to whether Date's effect varies between different vegetation types. – Aaron Macy Aug 4 '16 at 14:56

[response] ~ (1|Block) + (1|Block:Subject) + (1|Date) + Vegetation + (1|Vegetation:Date)

You don't have sufficient levels of Vegetation to treat it as random, and you have also stated that it is fixed, so even philosophically, you shouldn't include it as a random effect.

You also don't have sufficient levels of Block to treat it as a random effect either.

A better model would be:

[response] ~ Vegetation*Date + Block + (1|Subject)

This will estimate fixed effects for Vegetation, Date and their interaction, while controlling for the repeated measures within Subject by estimating random intercepts.

Since you have 10 dates and 3 vegetations, this will result in quite a lot of interaction terms (18), if you code Date as a factor. If Date is numeric (for example the number of days since the experiment began), this will enable you to model the (linear) change in the response as a function of time. You could then also allow the effect of time to vary for each Subject with a random slope: (Date|Subject). You could also add a quadratic term for to cater for non-linear change.

• Is there any reason Date cannot be random? – Aaron Macy Aug 5 '16 at 15:20
• I like the idea of treating Date as a numeric variable, but this would be strictly for linear regression analysis, correct? I was planning to use an exclusion method, running an anova between a full model & a model excluding the factor of interest. Would this allow me to treat Date as a random variable? I don't fully understand the threshold of levels to allow for a factor to be designated as "random", and I am unable to find a consensus from question like: stats.stackexchange.com/questions/37647/… – Aaron Macy Aug 5 '16 at 15:27
• You wouldn't want to treat Date as a random intercept because you are explicitly interested in it's effect on the response and it's interaction with other fixed effects. Yes, my model formulation is for a linear association, but you can easily cater for non-linearity by including higher order terms such as I(Date^2) – Robert Long Aug 5 '16 at 16:13