I have a model in R looking at infectious disease spread on social networks, and I am running into a problem where my data are clearly not normally-distributed when I try to run a linear regression but I'm unsure of how to approach it. My dependent variable/outcomes are maximum prevalence, time of peak infection, length of outbreak, cumulative infection, and maximum Reff. My independent variables are homophily based on SES, homophily based on health behavior, probability of isolation, and length of isolation. The model is simulation based and I end up with 1000 data points.

I have some plots attached here using just the dependent variable of maximum prevalence, because the plots for all the outcomes look similar (from top left to right, then to the bottom row): histogram of my outcome, outcome vs residuals, histogram of residuals, fitted values vs residuals, QQ plot, and density of residuals. maximum prevalence model checking

I have pretty limited statistical knowledge so I'm unsure of the best next step to approach this.

  • HEAVY right skew based on the histograms but... (see point 3)
  • Residuals are dependent on the outcome; I'm thinking I'm not using the right distribution for this analysis (I used a normal distribution for these); is there a way to diagnose what the correct distribution would be?
  • QQ plot looks to me like it's indicating a heavy right skew, but log-transforming the data doesn't make anything look much better, including adjusted model R^2 and the QQ plot (see below) Log-transformed maximum prevalence check plots

My only guess is that I'm using the wrong distribution for my model, but is that the case? Am I missing a key takeaway from my plots?

  • $\begingroup$ The fitted vs residual tells the story, the rest are misleading. Your DV distribution is clearly discrete, maybe poisson, negative binomial, or perhaps zero- inflated versions of such. $\endgroup$ Commented Mar 16 at 15:35

1 Answer 1


In the case of maximum prevalence: I suppose it is a proportion. Therefore for this variable, I would modify your data set and add one column containing the maximum number of individuals which were infected, and an other column containing the number of individuals which were not infected (= total population minus the infected). I would then use the cbind function in a GLM for a binomial distribution.

In r it would look something like : glm(cbind(infected,non infected)~SES based homophily + behaviour based homophily + probability of isolation + length of isolation,family=binomial)

I would expect length of outbreak and cumulative infection to show a distribution characteristic of count data, probably overdispersed. I would then use a GLM for a negative or gamma distribution:

glm.nb(length of outbreak~SES based homophily + behaviour based homophily + probability of isolation + length of isolation)

  • $\begingroup$ Thank you so much! What's the reasoning for using cbind for the number of infected and uninfected to do the GLM for a binomial distribution? $\endgroup$
    – mxseabat
    Commented Mar 17 at 23:23
  • $\begingroup$ Because otherwise in order to analyse a proportion as binomial data you would need to have one line per individual in your dataset. I assume this would be a very large dataset ? $\endgroup$
    – CaroZ
    Commented Mar 18 at 22:55

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.