I am a biologist and am attempting to analyze the effects of time and location on depth. I was told I needed to use a mixed effects model to account for the random variables of Individual and tracking type, but am unfamiliar with the outputs and am having difficulty interpreting it. I am not sure if there is something wrong with my model, or if I do not correctly understand how to read the output.

I am attempting to analyze data that looks like this:

Name Seconds Depth Time Location  Place Tracking
8601   29422    19  Day      Off Hawaii   Active
8601   29434    29  Day      Off Hawaii   Active
8601   29444    36  Day      Off Hawaii   Active
8601   29455    44  Day      Off Hawaii   Active
8601   29466    50  Day      Off Hawaii   Active
8601   29480    55  Day      Off Hawaii   Active

and I built a model using R package lme4, function lmer. My model is


With output:

Fixed effects:
                     Estimate Std. Error t value
(Intercept)            28.577      4.263   6.703
TimeNight              26.021      6.341   4.104
LocationOn            -22.835      1.181 -19.327
TimeNight:LocationOn  -33.049      1.567 -21.088

Systematically removing terms revealed that Location, Time, and their interaction were all significant.

I am mostly interested in the differences between On/Night and On/Day, as well as Off/Night and Off/Day. I know that Off/Day is 28.577, with Off/Night at (28.577+26.021), and On/Day at (28.577-22.835). My trouble comes in interpreting Night/On, since the answer cannot be negative (can't have negative depth). Does the negative value mean this type of model isn't appropriate for my situation?

Also, is there a way to determine if the values for On/Night are significantly different from On/Day? Can I use a glht?

  • $\begingroup$ I think you should consider fitting the model with afex::mixed. Not only because I wrote it, it might give easier to interpret output. Alternatively or in addition you might want to pass the lmer or mixed object to lsmeans. Also easier than glht. $\endgroup$
    – Henrik
    Oct 23, 2014 at 19:46

1 Answer 1


If you're interested in those particular comparisons, the easiest thing to do would be to split the data into On and Off subsets, and run Day/Night comparisons separately in each one. (This would involve a few extra comparisons, but if you aren't doing something like an all-pairwise-comparisons analysis you can probably get away without a formal correction for multiple comparisons.)

The negative value is more problematic. It's hard for me to see circumstances where a model like this (a 2x2 interaction of categorical fixed predictors) would give you predicted results that were significantly different from the group means. I would look at model diagnostics and plots of your data: are there observations or individuals that are outliers?

I'm also a little surprised that you're treating Tracking as a random effect -- you don't say how many levels it has, but I'm guessing that it's either Active or Inactive (i.e., only two levels). If you want to control for it you would be better off treating it as a fixed effect ...

  • $\begingroup$ Thanks so much for your suggestions! If I were to split the data into On and Off subsets, would you recommend just building 2 models Depth~Time+(1|Name) ? I tried that and got values much closer to my calculated means, and much lower AIC (~280000 compared to ~640000). Do you have post-hoc test recommendations to determine significance between Day/Night values? I'm new at models, and feel a little out of my league. Any pointers are helpful! $\endgroup$
    – Yucca
    Oct 23, 2014 at 21:42
  • $\begingroup$ Also, I am not interested in the differences between tracking methods (you are correct in assuming two levels: Active and Passive), which is why I put it at a random effect. I thought it would make viewing the results for the variables I am interested in easier, but maybe that was an incorrect thought process? $\endgroup$
    – Yucca
    Oct 24, 2014 at 0:50
  • 1
    $\begingroup$ It's not necessarily true that "nuisance variable" = "random effect" (as is often assumed). For categorical predictors with small numbers of levels, fixed is usually better (for continuous predictors, fixed is the only option). Now that I think about it a bit more, computing the contrasts you're interested in via lsmeans() might indeed be best (since you have the same individuals in both On and Off), but subsetting would still be OK (then you don't need a post-hoc test, you just look at the parameters -- see ?pvalues for your choices on getting p-values) $\endgroup$
    – Ben Bolker
    Oct 24, 2014 at 1:22
  • 2
    $\begingroup$ the difference you're seeing in AIC is (alas) completely meaningless -- the AIC just goes down because you have about half as many observations in each group. $\endgroup$
    – Ben Bolker
    Oct 24, 2014 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.