# Linear Mixed Models non-independent data with unbalanced design and non-independent data?

I am new in trying to set up a mixed model and I would like some input concerning my model design.

I have been reconstructing the age of some plants and in each year I have been measuring their productivity. So I have a design which includes 580 plants, each plant has an age (varies from 4-25 years) and within each year I have a productivity measurement. I would like to see how the productivity relate to temperature changes.

So with this experimental design I am facing two main problems:

1. Within each plant, the measurements between the years are non -independent
2. Each plant has a different time range (4 minimum, 25 maxmimum)

I started by trying an LMM model, fitting the variable "plant" as random effect to account for the non-independence of data within each plant. So my model had the form:

model1 <- lmer(Productivity ~ Temperature + (1|Plant), data=data)


As a second step I wanted somehow to include the fact that each plant has a different time range … So, I included the factor Year nested in Plant.

So the second model had the form:

model2 <-lmer(Productivity ~ Temperature + (1|Plant:Year),
data=data)


The results between these models are really different, so I am not sure which one better encapsulates my experimental design. I am not quite sure about the nested factor, as Years between plants in some cases coincide …

You say that

the factor Year nested in Plant

If Year is nested within Plant. In that case, the moel should be

lmer(Productivity~Temperature +(1|Plant/Year),data = data)


or eqivalently:

lmer(Productivity~Temperature +(1|Plant) + (1|Plant:Year),data = data)


So, just to clarify, this means that each Year belongs to one and only one Plant. So year 1 could belong to plant 1, and year 2 could also belong to plant 1, which means that for each year, one and only 1 plant was measured. For year 3, for example, this could belong to plant 2 (but not plant 1). The nested structure looks like

        Plant1             Plant2             Plant3
/     \            /      \            /     \
Year1  Year2        Year3  Year4        Year5  Year6



Edit: It appears from the comments that the design is partially crossed (partially nested). This might look something like

        Plant1     Plant2   Plant3
/\      /  \   \ / \
/  \    /    \   X   \
/    \  /      \ / \   \
Year1    Year2   Year3  Year4



In that case, the appropriate random structure is:

lmer(Productivity~Temperature + (1|Plant) + (1|Year), data = data)


More detail about nested and crossed random effects is here:
Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?

• Actually the design is not like that exactly.. PLant 1 can have Year 1 and Year 2, but plant 2 can have Year 2 and Year 3 (but not Year 1).. So, some years coincide between plants and some not.. So i am not sure the nested design is the right choice.. Commented Feb 24, 2021 at 9:31
• Thanks for the comments, really helpful.. So, a simple diagramm of my design looks like: Plant1 Plant2 Plant3 / \ / \ / \ Year1 Year2 Year2 Year3 Year1 Year3 So after reading a bit, i think is a crossed design and not nested.. Probably a more appropriate code would be: model3<-lmer(Productivity~Temperature +(1:Plant) +(1|Year), data= data) However, does this model takes into account that within each plant, the yearly measurements are non- indepenedent? Commented Feb 24, 2021 at 9:51
• Yes is does, although if there is structure to the non-independence, such as autocorrelation you may need to use a different package. Commented Feb 24, 2021 at 14:43
• @VictoriaL. Does this answer your question ? If so then please consider marking it as a the accepted answer and (if you haven't already) upvoting it. If not, please could you let us know why so that it can be improved Commented Jun 4, 2021 at 14:54