I am attempting to use C# (and the alglib library) to calculate the predicted probability that an outcome ends up in one of five classes. I have managed to calculate parameter estimates (i.e. slope and intercept values) for each outcome, using 1 group as a reference. However, I can't seem to figure out how to use these coefficients to calculate the predicted probability of each outcome on any given independent variable.

What is the operation needed to compute the probability for each outcome?

  • 1
    $\begingroup$ Have you looked at the equations for these probabilities? $\endgroup$ – whuber Sep 26 '12 at 22:14
  • $\begingroup$ I actually have a pretty good idea at this point what needs to happen. My remaining question is how to compute the reference group probability. $\endgroup$ – Sam Sep 26 '12 at 22:19
  • 2
    $\begingroup$ Sam, if you can compute all the other probabilities, then surely you can exploit the fact that they all must sum to unity! $\endgroup$ – whuber Sep 27 '12 at 0:44

The probability of any outcome $i$ in a multinomial logit model is $$P_i=\dfrac{exp(X_i\beta)}{\sum_Jexp(X_j\beta)}$$ Where $\beta$ is a vector of estimated parameters, which you say you already have.

The $X$ vector is composed of two types of variables:

  • Generic variables, which vary across alternative. For these variables, you get exactly one estimated parameter for the entire model.

  • Alternative-specific variables, which are endemic to the
    decision-maker. These variables create a different $\beta$ for each alternative.

The thing to remember is that $\beta_0=0$ for all of the alternative-specific parameters in the reference alternative, but not for the generic parameters. So in a model with three alternatives, one generic variable, and one alternative-specific variable, the utility equations ($X\beta$) are $$U_0=(0)+ \beta_1x_1 + (0)$$ $$U_1=\beta_{01} + \beta_1x_1 + \beta_{21}x_2$$ $$U_2=\beta_{02} + \beta_1x_1 + \beta_{22}x_2$$

$\beta_1$ shows up in every equation because it is generic. $\beta_0$ and $\beta_2$ are different for each alternative (one a constant, the other a parameter), and are equal to zero for the reference alternative.

  • 1
    $\begingroup$ You can also, as whuber mentions above, rely on the fact that $P_0+P_1+P_2=1$, especially if you know two of the three. $\endgroup$ – gregmacfarlane Sep 27 '12 at 0:49
  • $\begingroup$ How is the formula for $P_i$ derived? $\endgroup$ – Quirik Oct 4 '16 at 13:42
  • $\begingroup$ There's a derivation here: eml.berkeley.edu/books/choice2nd/Ch03_p34-75.pdf $\endgroup$ – gregmacfarlane Oct 4 '16 at 20:20

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.