Dear User,

I try to estimate an ordered probit using the CML package, however I don't get correct results (when comparing with what I actually simulate or results from stata). My llf looks like this:

`proc llf (b,X);`

local m;

m = X*b[1:2,.];

retp( (I00 .*ln(cdfn(b[3,1]*ones(t-1,1)-m))) + (I11 .*ln(cdfn(b[4,1]*ones(t-1,1)-m)-cdfn(b[3,1]*ones(t-1,1)-m))) + (I22 .*(cdfnc(b[4,1]*ones(t-1,1)-m))) ); //log likelihood function

endp;

with the I00,I11 etc being the proper indicators b[1:2,.] are the coefficeint and b[3,1] and b[4,1] are the cutoff points. I think the llf is correct so I'm really at a wondering why it doesn't work.

best

Oldes

## 6 Answers

0

Post the log-likelihood maximums from CML and Stata. Sometimes CML gets a different but better result. Of course other times there may be some other problem. I'll check your code.

0

Thanks for the quick response, good point: I looked them up and now I'm thoroughly confused since they are very different. For CML it is: -0.27130086, for stata it is -827.73002.

Also, as already indicated, I believe stata gives the correct results (since I simulate the DGP I know what the coefficients are), while CML does not. Thanks for checking the code.

best

Oldes

0

Early versions of CML posted the mean maximum, i.e., it divides the maximum by the number of observations. Multiply -0.27130086 for the CML maximum.

0

You log-likelihood doesn't seem right. Try this

proc llf(b,X);

local z1,z2,z3,m;

m = X*b[1:2,.];

z1 = I00.*(cdfn(b[3,1]*ones(t-1,1)-m));

z2 = I11 .*(cdfn(b[4,1]*ones(t-1,1)-m)-cdfn(b[3,1]*ones(t-1,1)-m));

z3 = I22 .*(cdfnc(b[4,1]*ones(t-1,1)-m));

retp(ln(z1 + z2 + z3));

endp;

0

Dear Ron,

thanks, this llf together with cleaning up the code (it was an old code which I only recently worked on again) works. But I still have a question, all my Econometrics books tell me that the llf is the sum of the logs and not the logs of the sum as it is in your case. So, why did you chose to model the llf in this particular way? An answer is grreatly appreaciated.

best

Oldes

0

I'm assuming that the indicators, I00, I11, I22, are exclusive, i.e., that when there is a one in given element of one of them, the corresponding elements in the other two are zeros. When you add z1, z2, and z3 you are getting a vector of individual probabilities for each observation, and the log-likelihood is the log of those probabilities.

## Your Answer

## 6 Answers

Post the log-likelihood maximums from CML and Stata. Sometimes CML gets a different but better result. Of course other times there may be some other problem. I'll check your code.

Thanks for the quick response, good point: I looked them up and now I'm thoroughly confused since they are very different. For CML it is: -0.27130086, for stata it is -827.73002.

Also, as already indicated, I believe stata gives the correct results (since I simulate the DGP I know what the coefficients are), while CML does not. Thanks for checking the code.

best

Oldes

Early versions of CML posted the mean maximum, i.e., it divides the maximum by the number of observations. Multiply -0.27130086 for the CML maximum.

You log-likelihood doesn't seem right. Try this

proc llf(b,X);

local z1,z2,z3,m;

m = X*b[1:2,.];

z1 = I00.*(cdfn(b[3,1]*ones(t-1,1)-m));

z2 = I11 .*(cdfn(b[4,1]*ones(t-1,1)-m)-cdfn(b[3,1]*ones(t-1,1)-m));

z3 = I22 .*(cdfnc(b[4,1]*ones(t-1,1)-m));

retp(ln(z1 + z2 + z3));

endp;

Dear Ron,

thanks, this llf together with cleaning up the code (it was an old code which I only recently worked on again) works. But I still have a question, all my Econometrics books tell me that the llf is the sum of the logs and not the logs of the sum as it is in your case. So, why did you chose to model the llf in this particular way? An answer is grreatly appreaciated.

best

Oldes

I'm assuming that the indicators, I00, I11, I22, are exclusive, i.e., that when there is a one in given element of one of them, the corresponding elements in the other two are zeros. When you add z1, z2, and z3 you are getting a vector of individual probabilities for each observation, and the log-likelihood is the log of those probabilities.