Say, I had a sample of discrete counts from a random phenomenon, with two categorical factor variables $T$ and $G$, where , $T$ has three levels $T_1$, $T_2$ and $T_3$ and $G$ has three levels $G_1$, $G_2$ , $G_3$.

What is a good way to estimate the effect of the individual levels, within each categorical variable on the observed counts?

For example, summing the proportions across any row or column seems to be taking into account the marginal effects. Log-linear modeling does not appeal to me much, as I am looking for a non-linear modeling, within the exponential family, say like a generalized additive model- but the factors and the discreteness seems to be an issue here as GAM's look for smooths over continuous variables.

Would the Sinkhorn-Knopp algorithm (iterative proportional fitting) solve this problem?


1 Answer 1


I don't know the Sinkhorn-Knopp algorithm, so it may be that my answer won't be of much help to you, but I thought I would leave some thoughts just in case. I can't follow your concern regarding log-linear modeling. The log-linear model for contingency tables is a saturated model; it will perfectly fit the observed frequencies. I don't think it will be of use to you, but I don't think linear vs. non-linear will have anything to do with it. I further don't see how summing proportions will do anything; the proportions in a row will either total to $1$, or the row's marginal proportion of the table sum, as you note.

When you have a contingency table with only $2$ rows, the odds ratio can be a convenient way to compare columns. For the most part, that isn't the case for you, but if you wondered about something specific, such as how much more likely it is that a case will be $G_1$ vs. other when it is $T_2$ vs. $T_3$, then you can just make a 2x2 contingency table from the relevant portion of the full table and use the odds ratio. There are other, more general, measures of effect size for contingency tables, like Cramers $\phi$ (or V), although I haven't found it to be very useful, because the interpretation (i.e., what counts as 'big') depends on the size of the contingency table. In addition, it indexes the association in the table as a whole; it is not specific to any row (column).

One thing that might be worth exploring is correspondence analysis, which is analogous to multidimensional scaling for a contingency table. CA is typically used just to make a plot for data exploration (see some examples here). Those plots may be enough to understand how different rows are related to each other, but if what you're looking for is a number, CA uses a value called the '$\chi^2$-distance' to assess how similar one row (column) profile is to another. It's calculation is explained here.

Again, I can't tell if a distance measure will really solve your problem, but it might be quite useful, even if it is coming at the question from a different perspective than you are.


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.