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

st: grid-searching an optimal value

 From econqian222 To statalist@hsphsun2.harvard.edu Subject st: grid-searching an optimal value Date Wed, 2 May 2012 22:16:23 -0700 (PDT)

```Hi,everyone
Thanks for a kind answer, unfortunately, it can't help to my question, I
would like to hear more regarding to my question.
I'm searching for an optimal value of "a" belong to the scale [1.05,
131.5] at jumping interval that is 0.05. Correspondingly, “b" belong to the
scale of [0, (a-1)/a] at jumping  interval that is (a-1)/30a. Actually， this
is a kind of grid-searching optimal value.
To minimize the sum of "u^2" by each value of code(1,2,3,4,...), where
u=y-ax1-bx2, we need to search the optimal value of "a" and "b" within their
respective scale and interval for each value of code(1,2,3,4,...).
How should I write the program for this task?

the format of data goes as following:
code       y               x1             x2
1       4.65605 .7904362        -1.918414
1       8.55465 .388749 -1.823626
1       .5072982        6.095053        -1.758411
2       .0668553        .0946494        -.0795475
2       4.346485        .0366412        .3990744
2       .453282 .6764894        .5537513
2       2.514498        4.424465        -3.335462
3       5.027869        6.576887        5.750454
3       1.121937        5.153405        2.404536
3       .3745422        .2155463        -.2841324
3       1.061227        .0074581        -.0889647
4       3.328544        12.11974        -6.351465
4       .1192554        .3238932        -.196535
4       71.84912        .3888368        5.285602
.       .                    .          .
.       .                    .          .

Qian

--
View this message in context: http://statalist.1588530.n2.nabble.com/grid-searching-an-optimal-value-tp7522393.html
Sent from the Statalist mailing list archive at Nabble.com.

*
*   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/
```