0

In my study I was sampling the same sites in different regions for many years. Each site has different properties in each year, which is important for my research question. I want to know, if the properties of the site affect biodiversity on the sites. And I am interested in the interaction of the propterties and the regions.

Overview:

  • Biodiversity = response
  • Site property = fixed factor, changes every year
  • Region = fixed factor , same regions every year
  • Site = random effect, is repeatedly sampled in the different sampling years
  • Year = random effect, is the factor in which "site" is repeated

At the moment my model looks like this:

mod1 <- lmer(biodiversity~region*siteProperty+(1|Year)+(1|site))

I'm not sure if this accounts for the repeated measures. Alternatively I was thinking about this one, as it includes also the nestedness of the sites in the years, but maybe that is not necessary:

mod2 <- lmer(biodiversity~region*siteProperty+(1|Year)+(1|Year:site))

The problem with this approach is, that it only works if my site properties are not zero. But I have zeros in different properties and I need to analyse their effects as well.

If you need more information, just ask me for. Thanks for your help!

MelChi
  • 9
  • 1

1 Answers1

1

Your first example,

mod1 <- lmer(biodiversity~region*siteProperty+(1|Year)+(1|site))

should be fine (although I'd encourage you to use the data argument explicitly ...). If you have samples for "many years" for each site, you might want to consider

  • including a trend model (i.e. include Year, as a numeric variable, in the fixed effects part of the model as well, either as a simple linear term or as part of an additive model, e.g. using splines::ns
  • checking for/allowing for autocorrelation (although this is tricky in lme4; you can use lme, but then crossed random effects of Year and site become harder).

If you have one sample per site/year combination, you don't want (1|Site:year), because that will be the same as the residual variability term.

Your statement "only works if my site properties are not zero" doesn't make sense to me: in general, having zeros in predictor variables shouldn't cause any problems ... ?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • Thanks for your answer! I'm not sure if this second model not works, because of the zeros. It was just the only difference I could find. I'll try to consider year as a factor and see what happens. – MelChi Aug 17 '16 at 12:20