I am researching whether software developers use different numbers of communication channels when performing different activities. Therefore, I would like to know whether, depending on the activity, the number of communication channels may significantly change.

I present below a pseudo data to illustrate my question:

enter image description here

How can I test for the significance of the difference between the number of channels used in different activities? I considered using the Kruskal.Wallis test, but I am not sure if Kruskal.Wallis is suitable given the count nature of my data.

Any suggestions?


Your data are not independent because the number of channels used per activity might depend on the project. A way to deal with this is by estimating a random effect for project in the context of a mixed model. In essence, you'd assume that the projects come from some larger population of possible projects. By estimating the variance between projects, you can account for this dependence.

Regression models are also capable of modeling counts, by using a generalized linear model (GLM) with a discrete error distribution, such as the Poisson or negative binomial distribution.

A generalized linear mixed model (GLMM) can combine these two elements. You can easily estimate the coefficients of such a model with the R package lme4.

While I highly recommend reading into GLMMs first,$^\dagger$ a simple example in R would be something like this:

GLMM <- glmer(number_of_channels ~ activity + (1 | project), family = 'poisson') # random intercept


GLMM <- glmer(number_of_channels ~ activity + (0 + activity | project), family = 'poisson') # random slope
GLMM <- glmer(number_of_channels ~ activity + (activity | project), family = 'poisson') # both
GLMM <- glmer.nb(number_of_channels ~ activity + (1 | project)) # random intercept, negative binomial

You can then make a call to the summary to see the effect of activity on the number of channels used. You can also bootstrap confidence intervals to get an idea of the uncertainty of your estimates. While $p$-values for GLMMs are not as reliable as for ordinary linear models, if you really think you need them, you could obtain them with the lmerTest package, after carefully doing the diagnostics.

Have a look at the mixed-models tag on the site!

$^\dagger$: For starters, you need to choose a link function for your GLM, and you need to choose between a random intercept, slope, or both). The diagnostics in GLMMs are also harder than for simple tests and models.

Another practical consideration: If number_of_channels are always at least 1, you could subtract 1 from them, as the Poisson and negative binomial distribution start at 0.

  • $\begingroup$ Thank you for the thorough answer, I'll definitely try the Poisson and negative binomial models $\endgroup$ – Daniel Alencar Apr 23 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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