Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: grid-search for a practical problem |

Date |
Tue, 6 Dec 2011 09:08:00 +0000 |

Mata has a fine bundle of optimisation functions. I would look there rather than re-invent your own. Your problem does not come across as having a flavour of -by:- or -by()-. You want to repeat for five values of -hs-, which implies at most a loop. Nick On Mon, Dec 5, 2011 at 11:49 PM, econqian222 <maguixianstatalist@gmail.com> wrote: Thank you very much for your kind and useful feedback for my similar > questions. To state my problem simply, for each value of > hs(10290,10420,10511,10519,10591), I want to find a value of r which is > between 1.05 and 131.05, the interval is 1; For each value of r, there is a > value of s which is between 0 and ( r-1)/r , the interval is ( r-1)/(30*r) > to minimize U^2 where U is obtained by the following equation > U=y -((`r') / ((((`s')-1)^2) * (1-(`r')))) * x1hat-((2*(`r') -1) / > (((`s')-1) * (1-(`r')))) * x2hat > Finally, record such r and s for each value of hs > > The dataset goes like the following: > > hs y x1hat x2hat sigma > 10290 736 283.731 141 > 10420 826 10.615 1.375 > 10511 276 78 2.687 > 10511 528 196.735 3.278 > 10511 818 148.753 11.0796 > 10511 251 4.861 .718 > 10519 276 6.189 .718 > 10519 276 9.396 .621 > 10519 404 7.355 .636 > 10591 682 10.8318 .812 > 10591 528 9.09482 .636 > 10591 276 8.49024 .417 > * * 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/

**References**:**st: grid-search for a practical problem***From:*econqian222 <maguixianstatalist@gmail.com>

- Prev by Date:
**RE: st: Model for Poisson-shaped distribution but with non-count data** - Next by Date:
**Re: st: Model for Poisson-shaped distribution but with non-count data** - Previous by thread:
**st: grid-search for a practical problem** - Next by thread:
**st: System - Diff GMM with fixed effects** - Index(es):