Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Abhimanyu Arora" <abhimanyu.arora@student.kuleuven.be> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: optimization in mata but unique obj function |

Date |
Thu, 15 Apr 2010 11:07:45 +0200 |

Dear statalist This problem has not been addressed in the manuals (though there was an entry by in the statalist by Bob Hammond some time ago that came a bit close to it). So only your experience could help. The problem is the following- I need to estimate parameters by maximizing the likelihood function. There are two features of this function: (1) The function depends on the value of the observation in the following sense. Eg for x=1 L(x,theta)=ax, for x=2 L(x,theta)=bx. (2) Also included in the likelihood function is a function of parameters to be estimated (in other words a,b are functions of theta (vector)) Hitherto, I was using mata's optimize function- as I create my parameter function, referred in (2) in mata [(2) is also the reason for not using ml commands] The v0 evaluator would have served my purpose but it seems to have the following shortcoming: the form of the function has to be the same for all observations (pg 287-288 of the mata manual). How I tried to go about it *************************** I have my data as a matrix in mata , let's say 1000X1. After my void evaluator command, I create a loop (using for(i=1;i<1000;i++) I use the if x[i]==.... V=F(x[i])... And have a set of statements like these depending on values taken by x[i],V being my likelihood function (and F varies according to x[i] And use the necessary optimizing commands (And stata doesn't report error, neither does it gives estimates) Why I know this is not correct ****************************** I replicate the example in the mata manual (pg 288) (or first example of v0,v1,v2 in the online help for optimize) but which I use the for loop (i=1;i<11;i++) and use x[i] in place of x (adding removing ":" doesn't make a difference). And voila! I do not get the parameter estimates (should have got 3.71, 7.01 had it been ok). Hence the question is -while stata seems to take care of (1) as we can use our -if-qualifier in our likelihood evaluator, mata can address (2), but how can we take both into account? I hope the problem is not as difficult for you as it has been for me. Thank you very much for going through this long email. Best regards Abhimanyu Arora KU Leuven * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: AW: -outreg2- super-rows and super-columns** - Next by Date:
**AW: st: AW: -outreg2- super-rows and super-columns** - Previous by thread:
**st: -outreg2- super-rows and super-columns** - Next by thread:
**st: Merging 2 variables to calculate time elapse (time/date)** - Index(es):