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).

  • $\begingroup$ 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. $\endgroup$ Commented Apr 22, 2014 at 21:00
  • $\begingroup$ @JeremyMiles What does reference group mean? My events are 1s and non-events are 0s. I use MATLAB's glmfit. $\endgroup$
    – Maddy
    Commented Apr 22, 2014 at 21:01
  • 1
    $\begingroup$ 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$. $\endgroup$ Commented Apr 22, 2014 at 21:04
  • $\begingroup$ @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). $\endgroup$ Commented Apr 22, 2014 at 21:11
  • 1
    $\begingroup$ @JeremyMiles as far as I know, MATLAB treats 1 as an event. Though I cannot find any conclusive proof of this online $\endgroup$
    – Maddy
    Commented Apr 22, 2014 at 22:16

1 Answer 1


That is quite clever. Unfortunately, your understanding of what logistic regression coefficients for categorical data mean is wrong. Logistic regression (really any form of regression) uses reference level coding by default to represent the levels of a categorical variable. (To learn more about reference level coding, see my answer here: Regression based for example on days of week.) Thus, the beta for a given level of your categorical variable is telling you the difference between the mean level of the response (or the link-transformed mean in logistic regression) in that level of your categorical variable and the mean level of the response in the reference level. They do not index how the mean level of the response differs from the expected count. Moreover, they will vary if you change which level of your categorical variable is used for the reference level.

On a different note, I don't see any need to "validate" your chi-squared test by running a logistic regression. If the chi-squared test is appropriate for your data and hypothesis, you can run it and stop. Nothing more is needed.

  • $\begingroup$ Chi-Square will only show an association but LR can prove its direction as well. For example, Chi-Sq can show cash and bankruptcies are related but LR can show the lower cash levels are positively related to bankruptcies. Please see your response at stats.stackexchange.com/questions/88630/… I have usually found that when odds for an event happening are higher for a categorical variable, then its observed count is also >> expected count. It seemed fine as it fit the theory (eg. when cash is below $10 million, chance for bankruptcy is high). $\endgroup$
    – Maddy
    Commented Apr 22, 2014 at 22:19
  • $\begingroup$ That's a good point, @Maddy. If you prefer LR, you can just go straight to it & use that. My larger point is that there is no need to use both. $\endgroup$ Commented Apr 22, 2014 at 22:21
  • $\begingroup$ I see. Your response also implies that when observed count >> expected count, it does not imply that LR coeff. will be positive? It completely changes how I interpreted the chi-sq and LR results to roughly prove my hypothesis. $\endgroup$
    – Maddy
    Commented Apr 22, 2014 at 22:27
  • $\begingroup$ Interpreting your comments in line w/ your other Q, you should represent your categories as a quantitative variable using estimated levels of cash on hand for each category. Then you will have only 1 LR coefficient for CoH, & it will be more interpretable for you (although you may want to add a squared term to capture a curvilinear relationship). But at any rate, yes, the LR coefficients for categorical variables have nothing to do w/ exp > obs or exp < obs. To get a fuller picture of reference cell coding, read my other answer. $\endgroup$ Commented Apr 22, 2014 at 22:31
  • $\begingroup$ Thanks. I still cannot accept the idea that LR coeff are negative for a situation where obs >> exp! Hard to get rid of a stubborn idea. I couldn't find any research online that can help link or de-link these two. I cannot have 1 LR CoH coeff. The actual scenario has 5 different categories: <10million CoH, Btw 10-20million CoH, ..... I use 4 dummy categorical variables. $\endgroup$
    – Maddy
    Commented Apr 22, 2014 at 22:56

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.