# Logistic regression: Compare groups with highly different sample sizes

This is a theoretical question! Sorry for that. Any help is appreciated.

I am exploring the association between two binary factors using an odds ratio in a large sample that is highly imbalanced: The whole sample contains 150,000 individuals. Of these 146,000 are eating an apple (apple+) and 4,000 never eat an apple (apple -) Suppose my dependent variable is 0=not happy, 1= happy And I have 6 more independent variables say age, daylight, etc.

Can I do a multivariate logistic regression although the predictor of interest is imbalanced in distribution without breaking any assumptions?

In a logistic model, sparse strata may lead to unstable odds ratios. This small sample bias can cause the odds ratio to be biased away from the null and the standard errors to explode moreso that the inference tends to be conservative.

To assess the possibility of this bias, a simple diagnostic is to perform a simple cross-tabulation of all the factors. If any cell has fewer than 5 observations, then the tendency may be for bias in the odds ratio, and a continuity correction may be applied.

• Thank you AdamO!!! – TarJae Mar 10 at 17:35

This question is not only theoretical but also very practical!

The theory does not exclude at all unbalanced problems such as the one you propose. Indeed the logistic regression model is based on the response following the probability model of a Bernouili trial and the probability of response can be in the range from $$0$$ to $$1$$.

The points to be careful of should be:

• first to be sure to have enough data to perform the inference, especially if you have multiple dimensions as you mention. Be sure to cross-validate your learning,
• second, to use the proper accuracy score such as an balanced accuracy score

Hope this helps!

• Thank you meduz! – TarJae Mar 10 at 15:09
• This is not quite right. Apple eating is the highly imbalanced factor, and it is specifically a predictor in the OP's question. We don't assign a probability model to the predictor. – AdamO Mar 10 at 16:59
• I'm with @AdamO that this is not quite right and should not be the accepted answer as it stands. – Dave Mar 10 at 17:04
• thanks @AdamO for the edits - does that answer to your concerns of Dave ? – meduz Mar 27 at 14:37