Bookmark and Share

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]

Re: st: matrix of initial values in ml estimations


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: matrix of initial values in ml estimations
Date   Tue, 10 Apr 2012 16:00:18 +0200

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index