Aptech Systems, Inc. Worldwide Headquarters
Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286
Ready to Get Started?
For Pricing and Distribution
Training & Events
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
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.
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 Tagsapplications character vectors CMLMT Constrained Optimization covariance matrix datasets dates dlibrary dllcall error error codes errors Excel FANPACMT file i/o floating network GAUSS Engine graphics GUI hotkeys installation Java API license licensing linux loading data loops matrices matrix manipulation Maxlik MLMT operators OPMT optimization Optmum PQG graphics procs random numbers simgauss string functions strings structures threading Time Series writing data
Time Series 2.0 MT
Find out more now
Time Series MT 2.1
orddered probit and CML
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);
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
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.
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.
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
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));
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.
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.