1
$\begingroup$

I am totally new to using glm-function. I have tried to model my data with lmer-function but the excessive amount of zeros skew the residuals heavily (cubic root transformation helps some tho). The response is the percentage of errors in a test and the explanatory variable is a reaction time in another test reflecting the level of vigilance. There are results from two test sessions combined. Therefore, there are two error and reaction time results in a one data set I am modelling. My lmer-model would have been like this:

lmer(omission_error ~ reaction_time + (1|id), data = data)

There is a percentage of errors below in a histogram so you can see the distribution. Lots of participants are not making these particular errors at all but some still are. Therefore, if i fit the model using glm.nb, the residuals seem to be normal. This is how I would model it:

m2 <- MASS::glm.nb(omission_error ~ reaction_time, weights=id, data = data)

I do not quite understand what does the "weights" imply but it seems to be important in order to normalize the residuals. Also, this is a one intriguing message in the output: (Dispersion parameter for Negative Binomial(0.3465) family taken to be 1).

Have I modelled my data correctly?

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ I'd always recommending starting with the statistical question you do have, not with the R functions you happen to be using (which are secondary here). $\endgroup$
    – Nick Cox
    Commented Feb 20, 2021 at 14:41

2 Answers 2

1
$\begingroup$

Using weights=id isn't going to control for repeated measures on id. (Saying that is assuming that you do have repeated measures or some other kind of grouping.) You haven't described your study or your research question(s) so it is hard to be sure.

So, since you have count data, and an excess of zeros, a good approach would be to fit a zero-inflated model. The message from glm.nb suggests that you might have under-dispersion, however since you haven't accounted for the excess zeros, this may be misleading. I would start with a zero-inflated Poisson generalised linear mixed model.

$\endgroup$
1
  • $\begingroup$ Thank you for your answer. I will take a look into this zero-inflated model. $\endgroup$
    – timothy
    Commented Mar 1, 2021 at 13:06
1
$\begingroup$

The response is said to be the percentage of errors in a test. That being so, it is bounded by 0 and 100. The lower zero bound is biting, meaning evident in the data, but the upper bound of someone getting every question wrong is still there in principle.

Regardless of that, by scaling to a percentage the fact that the original data are discrete is being ignored.

It's not obvious to me that a negative binomial fits the bill at all. Also, you are focusing on the marginal distribution of the response when the distribution of the response given the predictors is the main deal.

This situation of possible zero inflation often arises, one common reason being that the sample mixes different kinds (here, kinds of people). There isn't a simple solution that catches all. If you're studying alcohol consumption in a Western society on a particular day people like me might score zero on that day, but our average isn't zero: ideally you need data on who never drinks to be sure of the right modelling decision. If you're studying tobacco consumption on any day it might be easier to tell the non-smokers apart from the smokers. Here you're closer to the alcohol example, it seems.

As far as showing us the data is concerned, I'd prefer a histogram showing the number of questions wrong (0, 1, ...). Yours is too coarse to show well the detail that is of interest.

As far as modelling the data is concerned, I would start with treating the number of questions right as a binomial response.

To me zero inflation needs to be really obvious to justify the more awkward models it entails, but zero-inflated binomials do exist.

(As a teacher, I am more familiar with the opposite: several students get full marks, and you can't tell who has a really excellent understanding or who is just very good.)

$\endgroup$

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.