I want to fit a linear mixed effect model with a response variable called "PhiPS2", along with independent variables such as habitat, season, and species. However, I'm not sure which of these independent variables should be the random effect.
The experimental design looks like this- the PhiPS2 is measured in different plants from different habitats. Different habitats have different species, but few of the species are occurring in more than one habitat. I have total of 310 individual plants, comprising of 10 species from 5 different habitats. and 3 out of 10 species occurring in more than one habitat (10 species, 5 replicates, 5 habitat types, 4 times(June-Sept = season)). There is no pseudoreplication, because each time, different plant individual is measured from the same habitat.
I am hoping to find answer to the following questions:
- How PhiPS2 value varies with habitat seasonally (I think species variation should be considered as it explains a large proportion of variation.
- How PhiPS2 value varies for each species in different habitat seasonally.
Maybe there is a partially crossed random effect. Not sure. Please suggest an R code for this model fitting. Below are some candidate models:
First Model
M1 <- lmer(PhiPS2 ~ habitat + season + (1|species), REML = F, data = physio2)
Second Model
M2 <- lmer(PhiPS2 ~ habitat * season + (1|species), REML = F, data = physio2)
Third Model
M3 <- lmer(PhiPS2 ~ habitat * season + (1 + species|habitat), REML = F, data = physio2)
seasoncorrespond to times here? – T.E.G. Jan 15 '24 at 00:21