# single measure of a fixed factor for each level of a random effect

I have a population animals, and am looking at the effect of (yearly) environmental temperature on date of birth and litter size. Births in the population have been monitored for 15 years (one litter per year), consequently, many females have been repeatedly observed giving birth over this time. Environmental temperature is the same for all animals within each year.

I am currently modelling this as a linear mixed model, with yearly temperature as a fixed effect and maternal ID as a random effect, to account for repeated measures of mothers.

A reviewer has recommended that I fit the model with Year as a random effect as well. However, because only a single yearly temperature applies to all mothers within each year, this drastically changes the results. - Essentially, the random effect of year soaks up all the variation due to temperature, rendering the effect of temperature nonsignificant. For temperature to not have an effect would be VERY surprising since experiments manipulating temperature directly show a strong effect.

What is the best way to proceed?

Thanks,

summary of LMM without Year as a random effect:

     AIC      BIC   logLik deviance df.resid
10378.6  10399.7  -5185.3  10370.6     1419

Scaled residuals:
Min       1Q   Median       3Q      Max

-2.35860 -0.60767 -0.02228  0.57020  3.08272

Random effects:

Groups   Name        Variance Std.Dev.

TrueID   (Intercept) 39.22    6.262

Residual             58.43    7.644

Number of obs: 1423, groups:  TrueID, 679

Fixed effects:
Estimate Std. Error        df t value Pr(>|t|)

(Intercept)   36.3515     0.3320  582.1000 109.476  < 2e-16

CritTemp.c    -3.0817     0.3757 1238.7000  -8.203 4.44e-16

Correlation of Fixed Effects:

(Intr)

CritTemp.c 0.010


summary of LMM with Year as a random effect:

     AIC      BIC   logLik deviance df.resid

9819.7   9846.0  -4904.8   9809.7     1418

Scaled residuals:

Min      1Q  Median      3Q     Max

-3.2943 -0.4964  0.0186  0.4700  3.4843

Random effects:

Groups   Name        Variance Std.Dev.

TrueID   (Intercept) 39.16    6.258

Year     (Intercept) 27.80    5.273

Residual             31.73    5.633

Number of obs: 1423, groups:  TrueID, 679; Year, 16

Fixed effects:

Estimate Std. Error     df t value Pr(>|t|)

(Intercept)   36.550      1.358 16.900  26.917 2.66e-15

CritTemp.c    -2.757      1.976 16.145  -1.395    0.182
---

Correlation of Fixed Effects:

(Intr)

CritTemp.c -0.095

• Please include the summary(model) output for both models (with and without year as a random effect) Oct 7, 2018 at 10:34
• @Robert Long Have added model results Oct 8, 2018 at 1:55
• Are the variables critTemp and year highly correlated? The second model tells you that after you accoutn for the variation of the years, the temperture becomes non-significant, since year explains all that temp explained before. Oct 8, 2018 at 8:09
• Are you sure that the reviewer wanted random intercepts for Year and not random slopes ? Random slopes might make more sense - but you should code the Year variable as numeric, not a factor. Oct 8, 2018 at 8:35
• @Robert Long Year is coded as a factor because I am controlling for repeat measures within years, not the effect of time per se. I'm pretty sure the reviewer only wanted random intercepts. Nevertheless, running with year as numeric and with random slopes still results in NS effect of temperature. Oct 8, 2018 at 22:20

As fleshed out in the comments, if you don't expect any overall effect for Yearand you are not interested in the individual Year estimates, then indeed random intercepts are a better model. In this case you can talk about the variance expained by each level. One major benefit is the greater degrees of freedom in the random intercepts model. Do check the residuals at all levels and do the usual fit tests.

Oh and you can always report the results for both models.

• Thanks, but how should I interpret the output? As I say above, theory, other analyses, and experimental work all point to temperature having a significant effect on date of birth (these are reptiles). Including Year as a random effect causes Temperature to appear non-significant because all the variation due to Temperature is sucked up by Year. Is it appropriate (as the reviewer has suggested) to include a random effect for Year when the fixed effect has a common value for all records in that Year? Oct 9, 2018 at 0:40
• You can interpret the random intercepts model in terms of variance partitioning, and you can report the fixed effects model in terms of individual estimates. The 2 models are complementary. In general, with clustered observations, where the only requirement is to control for correlations within clusters, then both fixed effects, or random intercepts will do that. For the random intercepts model, it doesn't make much sense to also include Year as a fixed effect - it is either one or the other. Oct 9, 2018 at 18:31
• @ElectricMonk if my answer answers your question, please can you mark it as accepted. If not, do you have a further related query ? Nov 27, 2018 at 21:08

I'm sure this was resolved a while back, but I just posted a very similar question here and wanted to share what I found.

I recommend checking out the link, but to summarize briefly: As best as I can tell, if you fail to include a random effect of year, the model will wrongly assume that every row represents an independent temperature measurement, that is, it will think you have a larger sample size than you actually do. This will result in underestimation of standard error for your temperature fixed effect, and inflate your significance. My understanding is that if there is a true, strong effect of temperature, it should remain significant even as you add the random effect of year.

There are some alternative methods you can use, though, if you want to double check. Those are, again, given in the answer to my post linked above.