I am working on disease infection data, and I am puzzled on whether to handle the data as "categorical" or "continuous".

  • "Infection Count"
    • the number of infection cases found in a specific period of time, the count is generated from categorical data (i.e. no. of patient tagged as "infected")
  • "Patient Bed Days"

    • sum of total number of day stay in the ward by all patients in that ward, again, the count is generated from categorical data (i.e. no. of patient tagged as "staying in that particular ward")
  • "infection per patient bed days"

    • "infection count" / "patient bed days" both were originally count data, but now becomes a rate


  • Can I use Chi-Square here to assess whether the difference in "infections per patient bed days" is statistically significant or not?


I have found that I can compare the incidence rate (or call it infection rate), but doing something like "incidence rate difference" (IRD) or "incidence rate ratio" (IRR). (I found it from here)

  • What is the difference between IRD and t-test?
  • Is there any statistical test complementary for IRR?
  • 1
    $\begingroup$ I think asking another question separately is much better than updating your previous question. $\endgroup$
    – user28
    Commented Aug 4, 2010 at 12:42

6 Answers 6


For me it does not at all sound appropriate to use a chi-square test here.

I guess what you wanna do is the following: You have different wards or treatments or whatever else kind of nominal variable (i.e., groups) that divides your data. For each of these groups you collected the Infection Count and the Patient Bed Days to calculate the infection per patient bed days. Know you wanna check for differences between the groups, right?

If so, an analysis of variance (ANOVA, in case of more than two groups) or a t-test (in case of two groups) is probably appropriate given by the reasons in Srikant Vadali's post (and if the assumptions homogeneity of variances and comparable groups sizes are also met) and the beginner tag should be added.


I'm not quite sure what your data look like, or what your precise problem is, but I assume you have a table with the following headings and type:

ward (categorical), infections (integer), patient-bed-days (integer or continuous).

and you want to tell if the infection rate is statistically different for different wards?

One way of doing this is to use a Poisson model:

Infections ~ Poisson (Patient bed days * ward infection rate)

This can be achieved by using a Poisson glm, with log link function and the log of patient-bed-days in the offset. In R, the code would look something like:

glm(infections ~ ward + offset(log(patient-bed-days)), family=poisson())

Chi-square tests do not seem appropriate. As others said, provided there are a reasonable number of different rates, you could treat the data as continuous and do regression or ANOVA. You would then want to look at the distribution of the residuals.


If you were considering conducting Poisson or related regressions on this data (with your outcome variable as a rate), remember to include an offset term for the patient bed days as it technically becomes the "exposure" to your counts.

However, in that case, you may also want to consider using just the infection count (not the rate) as your dependent variable, and include the patient bed days as a covariate. I am working on a data set with a similar count vs. rate decision and it seems like converting your dependent variable to a rate leads to a decrease in variability, an increase in skewness and a proportionally larger standard deviation. This makes it more difficult to detect any significant effects.

Also watch out if your data is zero-truncated or zero-inflated, and make the appropriate adjustments.

  • $\begingroup$ I think this response most directly relates to the question in the title of the post, "How to handle count data (categorical data), when it has been converted to a rate?" $\endgroup$
    – N Brouwer
    Commented Sep 1, 2012 at 15:21

From a technical purist point of view, you cannot as your ratio "infection per patient bed days" is not a continuous variable. For example, an irrational value will never appear in your dataset. However, you can ignore this technical issue and do whatever tests that may be appropriate for your context. By way of analogy, incomes levels are discrete but almost everyone treats them as continuous.

By the way, it is not entirely clear why you want to do a chi-square but I am assuming there is some background context why that makes sense for you.


One way of proceeding is to construct various null models each of which assume factors are independent of one another. The independence assumption often makes these easy to construct. Then the predicted joint densities are the products of the marginal densities. To the degree the actual data are consistent with these, you know factors are independent. If they are greater or lesser than the joint prediction, you may be able to infer they co-vary positively or negatively. Be careful to consider numbers of observations in each case, and you may be able to do that formally by treating populations as extended hypergeometrics. This is all in the spirit of the Fisher Exact Test, but Fisher actually formulated it so more general situations could be modeled. See, for example, Discrete Multivariate Analysis: Theory and Practice, by Yvonne M. Bishop, Stephen E. Fienberg, Paul W. Holland, R.J. Light, F. Mosteller, and The Analysis of Cross-Classified Categorical Data, by Stephen E. Fienberg.


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.