Solved – Generalized linear model with mean contrast pairwise comparison versus chi-square tests

binary datachi-squared-testgeneralized linear model

I have binary data on prevalence of infection (infected/all analysed) and I want to compare this proportion between groups (species and sexes).

I would like to ask if by conducting a Generalized Linear Model with binomial distribution and mean contrast pairwise comparison (with 1/0 as target variable and the groups and their interaction as factors), the pairwise results I get are "the same" as conducting separate chi-Square tests.

If it is the same, I am using SPSS and I get a significance for the model effects and a slightly different significance for the pairwise comparisons. Which one should I report? What do these differences mean?

If it is not the same, I would like to ask what is the correct way to construct the contingency table for comparing, for example, species A with 12/30 with species B with 8/22. And within species A, males have 10/17 and females 2/13, while within species B, males have 5/10 and females with 3/12. Can I use chi-square with different sample sizes of each group? Does anyone know how to do this in SPSS (I think it requires same sample size)?

For Species A versus Species B, the result from chi-square is Pearson=0.07, P=0.79. Thus no differences between species.
For Male_A versus Female_A, result from chi-square is Pearson=5.79, P=0.02. Thus differences between sexes.

Is this correct?

Now imagine for A I have 4/29 and for B I have 2/16. If I am doing the chi-square table correctly, I have an additional problem of less than 5 in some cells, for which I only get Fisher's exact test.
The results are only for Fisher Exact Probability Test, P one-tailed=0.64 and P two-tailed=1. Does this mean there are no differences? Which P is relevant and how can I get a chi-square value in these situations?

Best Answer

The short answer is that separate chi-square tests or Fisher tests looking at specific questions are not the same as an over-arching GLM in effect asking several questions at once. Whimsically put, each separate test can't know about the other kinds of variations in the data.

I guess most statistical people would, on the information you supply, encourage you to work with an overall model with infected/not infected as a response and species, sex, interaction terms, and whatever else as predictors. Small frequencies in some cells won't make matters easy, but there will be less adhockery and less of a mess of lots of little tests.

You seem to be following the idea that there is a single correct analysis for your data that a statistically competent person should be able to tell you, but the best framework for you should also be chosen in the light of your scientific judgement about what is going on. For example, it's a matter of biological judgement about whether it makes sense to put different species in the same model.

Expected frequencies more than 5 is a very conservative rule for chi-square tests. In any case the sensitivity of chi-square tests to small frequencies can be explored computationally rather than being treated as a matter of dogma. However, as a GLM is likely to be the better framework here, that is secondary.