# [Limdep Nlogit List] Regarding calculating probabilities from ordered logit models

William Greene wgreene at stern.nyu.edu
Wed Aug 8 20:41:12 AEST 2018

```Dear  Ganesh Ambi Ramakrishnan
You are using the wrong formulas for f0, f1 and f2.  The sample program
below illustrates.
Regards
Bill Greene

sample ; 1 - 1000 \$
calc ; ran(12345)\$
create ; x1=rnn(0,1) ; x2 = rnn(0,1) ; u = rnu(0,1) ; e = log(u/(1-u))\$
create ; u = x1 + x2 + e \$
calc ; mu1 = 1 ; mu2 = 2 \$
create ; y = 0 \$
create ; if (u <= 0) y = 0 \$
creare ; if (u > 0 & u <= 1)y = 1\$
create ; if (u > 1 & u <= 2)y = 2 \$
creare ; if (u > 2) y = 3 \$
histogram ;rhs=y\$
ordered ; logit ; lhs = y ; rhs = one,x1,x2 ; prob=pfit \$
calc ; mu1 = mu(1) ; mu2 = mu(2) \$
create ; ufit = b(1)+b(2)*x1+b(3)*x2\$
create ; f0=exp(-ufit)/(1+exp(-ufit))\$
create ; f1=exp(mu1-ufit)/(1+exp(mu1-ufit))\$
create ; f2=exp(mu2-ufit)/(1+exp(mu2-ufit))\$
create ; p0=f0 ; p1=f1-f0 ; p2=f2-f1 ; p3=1-f2\$
create ; pmodel=(y=0)*p0 + (y=1)*p1 + (y=2)*p2 + (y=3)*p3\$
dsta;rhs=p0,p1,p2,p3,pfit,pmodel\$

On Fri, Aug 3, 2018 at 2:09 AM, Ganesh A R via Limdep <
limdep at mailman.sydney.edu.au> wrote:

> Dear Sir,
>
> I am trying to manually calculate the probabilities from the estimated
> coefficients of an ordered logit model.
> I am currently using ordinal data with responses 0,1,2 and 3.
> The LIMDEP manual says that if a constant "ONE" is included in the
> specification, then the first threshold is considered to be zero. Hence
> using that when I manually calculated the probability of each response, it
> doesn't match with the probabilities that are calculated via the model
> itself using the " ; prob = name  \$" function.
>
> Following is the method I used for calculating probabilities.
>
> U = bo + b1x1 + b2x2 + ..... + bkxk
> Where,
> U = utility function
> [b] = coefficients estimated from the model
> [x] = explanatory variables
>
> f(0) = 1 / (1 + exp(-U))
> f(1) = 1  / (1 + exp(mu(1) - U)
> f(2) = 1 / (1 + exp(mu(2) - U)
> prob(0) =  f(0)
> prob(1) = f(1) - f(0)
> prob(2) = f(2) - f(1)
> prob(3) = 1 - f(2)
> where,
> mu(1) and mu(2) are the threshold parameters obtained from the model
> f(0), f(1) and f(2) is the CDF
> prob(k) = probability of response k
>
> Thanking you
>
> Yours Sincerely
>
> Ganesh Ambi Ramakrishnan
>
> Doctoral Student
> _______________________________________________
> Limdep site list
> Limdep at mailman.sydney.edu.au
> http://limdep.itls.usyd.edu.au
>
>

--
William Greene
Department of Economics
Stern School of Business, New York University
44 West 4 St., 7-90
New York, NY, 10012
URL: https://protect-au.mimecast.com/s/ewMVCr8DLRtoOmXXC7w_Ma?domain=people.stern.nyu.edu
Email: wgreene at stern.nyu.edu
Ph. +1.212.998.0876
Editor in Chief: Journal of Productivity Analysis
Editor in Chief: Foundations and Trends in Econometrics
Associate Editor: Economics Letters
Associate Editor: Journal of Business and Economic Statistics
Associate Editor: Journal of Choice Modeling
```