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

# Re: st: matrix of initial values in ml estimations

 From Anisa Shyti To statalist@hsphsun2.harvard.edu Subject Re: st: matrix of initial values in ml estimations Date Tue, 10 Apr 2012 16:33:26 +0200

```Hi Marteen,

Thank you for your reply.  I am using a program that I define, with a
set of temporary variables etc.

The command I use is the following:

ml model lf wmidwr (alpha: option pl pu r = )(beta: ), technique(nr 6
dfp 3 bhhh 3) init(0.1 0.1, copy)
ml maximize,  iterate(160) difficult

Where shall I insert the loops for the initial values?

Thank you very much.
Anisa

On Tue, Apr 10, 2012 at 4:00 PM, Maarten Buis <maartenlbuis@gmail.com> wrote:
>
> On Tue, Apr 10, 2012 at 3:38 PM, Anisa Shyti wrote:
> > I would like to test a series of initial values for my coefficient
> > estimates in maximum likelihood.  For this particular estimation, I
> > have two parameters, which values for both may fall in the range (0
> > ,1).
> >
> > How can I define a matrix that tests for all the possible initial
> > values (eg., 0.1, 0.2, 0.3, ...., 0.9) for both parameters?
>
> The details depend on the exact program you are using but you'll
> probably end up using a nested loop, e.g.
>
> forvalues i = 1/9 {
>    forvalues j = 1/9 {
>        local a = `i'/10
>        local b = `j'/10
>        ... , from( /a=`a' /b=`b') ...
>    }
> }
>
> Notice that it is generally good practice to code -forvalues i = 1/9-
> and inside the loop divide `i' by 10 instead of -forvalues i =
> 0.1(0.1).9-. The reason is that a computer works in binary and in
> binary the number 0.1 is like 1/3 in decimal.
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
>
> http://www.maartenbuis.nl
> --------------------------
> *
> *   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/

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