Statalist


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

Re: st: Repeating a program


From   Neil Shephard <nshephard@nhs.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Repeating a program
Date   Thu, 11 Sep 2008 11:03:22 +0100

Larraine Becker wrote:
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.?

The -simulate- command may be of some use here. See -man simulate- for more details.

Neil

***********************************************************************
This message may contain confidential and privileged information.
If you are not the intended recipient you should not disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents. To do so is strictly prohibited and may be unlawful.
Please inform the sender that this message has gone astray before
deleting it. Thank you.

2008 marks the 60th anniversary of the NHS. It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS and would like an NHSmail email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***********************************************************************

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