I have run a logit model such that $Y$ ~ $X$, where $X$ is a categorical variable with 4 alternatives. I have dummy coded $X$ so I can perform regression, this means that category 1 is the base category.

I would like to compare the probability of each alternative $X$ including the base category.

The point of my research is to select "the worst" level of $X$ in the sense that it is the less likely to happen, or the most negative one. However, I am not sure on how to proceed so I thought on looking at probabilities.

Any suggestion on how to decide which of the four alternatives of $X$ is "the worst"?

  • $\begingroup$ The way your question is formulated now, it seems that you run a logistic regression of Y depending on X and you are trying to predict the probabilities of X. Is that intentional? Wouldn't you rather want to know the probabilities of Y for each category of X? $\endgroup$ – Kenji May 23 '17 at 13:59
  • $\begingroup$ Yes, I want to know the probability of Y for each category of X. I could compute the Odds ratio and then the probability for each category, but is there another method I could use? Thanks $\endgroup$ – adrian1121 May 23 '17 at 15:34
  • $\begingroup$ That is the only one, as far as I know. $\endgroup$ – Kenji May 23 '17 at 16:49
  • 1
    $\begingroup$ Well by constraint the effect for the reference category of X is null (Assuming you use dummy variables to estimate the effects of the remaining categories). So simply be looking at the model estimates you would already know which category is "worse" or "best". Example: The estimates for a 3-categ (X) are -0.2 and +0.5 for categ 1 and 2 respectively (and by constraint the effect for categ 3 is 0) => Ranking: categ 2 > 3 > 1. You can translate it into (Y) proba or elasticities but won't tell you much more than that. $\endgroup$ – Umka May 24 '17 at 9:19

You should use marginal predictions. The way they work, is that they use the estimated equation to calculate the predicted value of the logit with the other variables held at some value (which is usually the mean or the observed value) for each observation. The logit is then converted into probabilities and that value is averaged for each category in your X variable. This way you get the average predicted probability for each category of X with all other variables held constant.

The standard errors of the marginal predictions are calculated using the delta method. If the standard error of the predicted logit is:

$$ s_{p_{j}} = \sqrt(x_{j}Vx'_{x})$$

Where $V$ is the estimated variance matrix for the model and $x_j$ is the observation for which you are getting the error.

You can then get the standard errors for the predicted probabilities by:

$$SE = p_j * (1-p_j) * s_{p_{j}}$$

Where $p_j$ is the predicted probability for case $j$.

| cite | improve this answer | |
  • $\begingroup$ Thanks upvote! Do you know if it is possible to create some sort of confidence interval for the probabilities? I thought on using $\hat{\beta} \pm 2\sigma^{2}$ and then computing odds ratio and probabilities.. $\endgroup$ – adrian1121 May 24 '17 at 7:37
  • $\begingroup$ You can calculate the confidence intervals using the delta method. This FAQ on the Stata website may help you with some code that you may convert to whatever software you use. $\endgroup$ – Kenji May 24 '17 at 7:47

If X is ordinal, you can try applying a PCA transform after the dummy coding. Retain only the first PC coordinates as a single continuous variable instead of the untransformed dummies. Plot the three dummies along the first two PCs first to check whether they follow any interpretable or meaningful order. If so, then this approach, which is slightly different from what you've requested, will provide a seamless impact of each category or even a subgroup of categories on Y. While you will only use the more abstract PC as a regressor, you can always trace back its meaning to the dummy variables.

E.g. If you have 3 dummies taking the values, very happy, happy, unhappy, the reference being very unhappy, then the 1st PC could translate the degree of happiness or unhappiness or other, depending on their order along the said PC.

More details on this approach can be found in Gordon Linoff's Data Mining book.

| cite | improve this answer | |
  • $\begingroup$ Thank you for your response but I am looking for a more general answer. This is part of a larger recursive algorithm and cannot go into PCA for efficiency reasons. $\endgroup$ – adrian1121 May 23 '17 at 15:34
  • 1
    $\begingroup$ That's okay, however, providing more information about how your use case and in particular not hiding the aforementioned constraints / complexities also helps others with their reply. $\endgroup$ – g3o2 May 23 '17 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.