On Mon, 24 Oct 2005, maite wrote:

> I was trying to generate samples of 50 observations in a Monte 
> Carlo loop and then just use the first 25 to estimate by OLS. I 
> wrote these instructions:
>
> nulldata 50
> genr x=100*uniform()
> loop 1000
> genr eps=3*normal()
> genr y=5+2*x+eps
> smpl (obs<26) --restrict
> ols y const x
> genr bhat=coeff(x)
> store test.gdt bhat
> endloop
>
> But, when I run the program and open the test.gdt data file, I 
> only get 1 observation of the variable bhat, instead of the 1000 I 
> was supposed to get. I have tried a thousand different things and 
> I do not get right. Any hint?

For the behavior you want, you need to give the "--progressive" 
option to the loop command:

   loop 1000 --progressive

Then you will get 1000 values of bhat in test.gdt.

Allin Cottrell




-- 
Allin Cottrell
Department of Economics
Wake Forest University, NC

Reply via email to