3

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?

Sam
  • 31
  • 1
  • 2
  • 1
    Have you looked at the [equations for these probabilities](http://en.wikipedia.org/wiki/Multinomial_logistic_regression#As_a_log-linear_model)? – whuber Sep 26 '12 at 22:14
  • 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. – Sam Sep 26 '12 at 22:19
  • 2
    Sam, if you can compute all the other probabilities, then surely you can exploit the fact that they all must sum to unity! – whuber Sep 27 '12 at 00:44

1 Answers1

2

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.

gregmacfarlane
  • 3,242
  • 21
  • 34