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?
 A: 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!
A: 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.
