### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

### Have a Specific Question?

### Q&A: Register and Login

### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall econometrics Editor error error codes errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation license licensing linux loading data loop loops matrix manipulation Maximum Likelihood Maxlik MaxLikMT Memory multidimensional array optimization Optmum output panel data PQG graphics procs random numbers strings structures threading### Recent Questions

- plotSetXRange is not working
- Gauss Mac Installation
- Can i get MaxLik Packge for Mac OS
- How to run Narayan and Popp (2010) unit root test with two structural break
- ThreadFor again
- cml.lcg zip file
- nelder-mead optimization algorithm
- Kernel regression - kreg
- exponential matrix
- Panel unit root test with structural breaks - calculating break dates

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

### Find out more now

### Find out more now

# Resources

# orddered probit and CML

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

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.

## 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.