I have an unbalanced data set / data set with missing values, consisting of 20 submersible acoustic receivers that have been range tested on 8 days (Both receiver ID and Day are treated as random effects in my model). My aim is to test the effects of multiple environmental variables on the detection range of these receivers. Unfortunately, due to technical issues, a total of 5 receivers could not be tested every day (e.g., 2 receivers could not be tested on 2 days, 3 could not be tested on 1 day).

What would be the right way to proceed? I have 2 choices: 1) reduce data set (exclude all receivers that are not tested on every day), or 2) work with full data set, including missing values.

The first choice is easy, but may not be the best choice (as far as I've read online). besides, collected data will be thrown away.. The second choice however seems more difficult to work with. I read that glmm in the lme4 package can deal with missing values, however, the only thing it does is automatically exclude all rows that contain NAs.

So let's say I choose the second option, and let the model run with missing values that automatically get deleted. How would this affect hypothesis testing? In other words, is the interpretation of p-values just as straightforward as when it would be a balanced design?

[EDIT: I worked out the full data analysis that excluded those receivers for my masters project in order to maintain a balanced data set, however for a publication I would like to analyse my data using the second choice, as I think it's a better one. There's not much literature surrounding this subject as far as I'm aware, hence my post to this forum.]

  • $\begingroup$ Why not just excluding the actual missing data? If you format your data with columns ID, Day, environmental variables, response, everything should be fine to just omit the missing measurements, keeping in the other measurements on those IDs. $\endgroup$ May 12, 2014 at 17:29
  • $\begingroup$ Thank you for your reply. To be very clear, by omitting the missing data I can safely proceed with hypothesis testing in exactly the same way as when I would be having a balanced data set? $\endgroup$ May 12, 2014 at 17:43
  • $\begingroup$ More or less, yes. I don't know what methods you were using before, but for models like this it's generally accepted that the most accurate confidence intervals are obtained by bootstrapping, e.g., by using lme4::confint() with method = "boot". That method will not care if your data is balanced or not. $\endgroup$ May 12, 2014 at 18:03
  • $\begingroup$ Thank you, I haven't used any method before I'm afraid, just hypothesis testing by means of finding the minimum adequate model. I will look into it in more detail. $\endgroup$ May 12, 2014 at 18:35

2 Answers 2


Turning my comments into an answer as they seem to have answered your question...

Just exclude the actual missing data. If you format your data with columns ID, Day, environmental variables, response, everything should be fine to just omit the rows where an ID is missing a measurement on a certain day, still keeping the other measurements on those IDs.

For inference, you'll get the best accuracy using bootstrapped estimates, (lme4::confint() with method = "boot" works well -- you'll need to install the boot package for this to work). If you want more info on that, I'd recommend Faraway's Extending the Linear Model with R, section 8.2. The lme4 package has been considerably updated since Faraway's book's printing, you can see the accompanying transition guide. The principles, of course, remain the same.

  • $\begingroup$ This would be the way I would do it, but I want to emphasize that your data needs to be in the 'long' or 'narrow' format as opposed to wide. This way you don't drop measurements that you do have data for. See data formats $\endgroup$
    – bdeonovic
    May 12, 2014 at 23:06
  • $\begingroup$ Thanks Benjamin, I have it in the 'long' format. I made this mistake some time ago on a different project, but I learned from it :) Better to prevent than to repair wrongly formatted data frames. $\endgroup$ May 13, 2014 at 8:46
  • $\begingroup$ I forgot to mention that I'm trying to fit a binomial and poisson GLMM. Does that matter for the explanation you gave earlier? $\endgroup$ May 13, 2014 at 10:09
  • 1
    $\begingroup$ @MvZB: no it doesn't. $\endgroup$
    – Ben Bolker
    May 13, 2014 at 15:15

You must create an indicator variable as control in your model: 1 for acoustic receiver in the missing day and 0 for complete data. Repeat the code for the same acoustic receiver in all its observed and unobserved days (in wide format data base, before converting to long format). You can do it for any missing day or one indicator variable for each missing day separately or grouping days as you consider important. If the indicator variable has no statistic significance, missing data is unimportatnt for the model, but statistic significance shows that the nonobservation is due your dependent variable or vice-versa.

  • $\begingroup$ I have tried to improve some of the English, but could you clarify "nonobservation is due your dependent variable or vice-versa"? $\endgroup$
    – Silverfish
    Jul 5, 2016 at 20:06

Your Answer

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

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