Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Repeating a program


From   Larraine Becker <lbecker@unimelb.edu.au>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: Repeating a program
Date   Thu, 11 Sep 2008 16:10:42 +1000

Thanks Ashim.  I've used forvalues...hopefully I'm getting the right
answers....!

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ashim Kapoor
Sent: Thursday, 11 September 2008 3:36 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Repeating a program

Hello,

I do this all the time.

Here is how I do it.

I would say : -

forvalues x = 1 2 3 4 5 6 7 8 9 10 {

run program using parameter `x'

}


So what you wanna do is probabaly FIRST generate random numbers, store
them in a variable and use that in place of 1  2 3 4 5 6 7 8 9 10 .

You could also do 2 loops

forvalues index = 1 / 100 {

foreach x in random_number[`index'] {
do my code

}


}

Ashim

On 9/11/08, Larraine Becker <lbecker@unimelb.edu.au> wrote:
>
>
>
> Hi everyone
>
>
>
> I want to run a logit program 1000 times, outputting the predicted y
values
> each time.
>
> I'm not sure how to go about this - I was thinking of doing a
simulation,
> but before I submit the logit command, I also use a random number
generator
> to randomly change variables in order to compare the predicted values
each
> time.
>
>
>
> Not sure if the above makes sense, but does anyone have advice on how
to do
> this - keeping the output so that in the end I can compare means,
etc.?
>
>
>
> Thanks
>
> Larraine

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



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