# Signs on logistic regression betas flip relative to observed - expected counts from chi-squared test

I conduct a chi-squared analysis on some bins and conclude that an association between the bins and an event exists. I then calculate logistic regression coefficients to validate my hypothesis. Also, I always look at the observed vs expected count in each bin (from chi-squared) to guesstimate logistic regression results.

For example, if Bin 1 had an observed count = 152 but an expected count of 85, I would estimate that the over all chi-square result is likely to be significant and Bin 1 is likely to have a positive coefficient from the logistic regression. However, this Bin 1 has a negative coefficient from logistic regression. Is my understanding wrong - when observed >> expected, logistic regression coefficient should be positive?(assuming here that results are significant).

• This sounds like it's the choice of reference group that matters. If your data are coded 0, 1, most packages take the zero as the reference. SAS, for example, takes the last value alphabetically as the reference, so 1 would be the reference, and all the signs would flip. Commented Apr 22, 2014 at 21:00
• @JeremyMiles What does reference group mean? My events are 1s and non-events are 0s. I use MATLAB's glmfit. Commented Apr 22, 2014 at 21:01
• You needn't capitalize so much; things like logistic regression are not proper nouns & aren't normally capitalized. In addition "chi-squared" is definitely lower-case, consider Chi: $X$ vs chi: $\chi$. Commented Apr 22, 2014 at 21:04
• @Maddy I don't know anything about Matlab, but it might depend on what Matlab calls the event. (SAS would call 0 the event, Stata would call 1 the event). Commented Apr 22, 2014 at 21:11
• @JeremyMiles as far as I know, MATLAB treats 1 as an event. Though I cannot find any conclusive proof of this online Commented Apr 22, 2014 at 22:16