[Gretl-devel] 'seed'
Riccardo Jack Lucchetti
r.lucchetti at univpm.it
Tue Aug 29 12:38:23 EDT 2006
On Tue, August 29, 2006 18:04, Ignacio Diaz-Emparanza wrote:
> ¿Another bug?
>
> With the current Windows snapshot (build 8/22/2006) I was checking if
> the new "seed" option in the /add/normal/random variable/normal dialog
> box works. Datafile data9-9 was opened, I selected the above entry in
> the menu, I put "3" in the seed box, and generated a normal (0,1)
> variable with name "norm", I repeated the operation changing the name
> to norm2, and the result was:
>
> Obs norm norm2
>
> 1976:1 1,232701 -0,017542
> 1976:2 -1,862191 0,237066
> 1976:3 1,277692 1,959801
> 1976:4 0,033582 -1,375184
> 1977:1 -0,739636 0,817394
> 1977:2 ...
>
> The funny thing is that if I close gretl and repeat exactly the same
> procedure, exactly the same values are generated.
> I also tried opening a new gretl session an calling the first
> variable "norm2", and the second "norm", the result was
>
> Obs norm2 norm
>
> 1976:1 1,232701 -0,017542
> 1976:2 -1,862191 0,237066
> 1976:3 1,277692 1,959801
> 1976:4 0,033582 -1,375184
> 1977:1 -0,739636 0,817394
> 1977:2 ...
>
> ¿Is this behavior correct?
Well, yes (unless I've misunderstood your point). That's the whole point of
setting a seed, you ensure the same set of psuedo-rv get generated each time.
The seed gives you the "starting point" of the generator, and from that point
on each pseudo-rv you generate comes from a deterministic sequence.
Compare with:
set seed 3
genr norm=normal()
set seed 3
genr norm2=normal()
print norm norm2 --byobs
and you get
Obs norm norm2
1:01 1.232701 1.232701
1:02 -1.862191 -1.862191
1:03 1.277692 1.277692
1:04 0.033582 0.033582
...
The thing is, you typically set the seed once and for all within a session; it
may be slightly misleading to have the choice to set the seed each time you
generate a pseudo-rv. Maybe it'd be better to move the text box for setting
the seed under "Tools/Preferences/General"?
Riccardo "Jack" Lucchetti
Dipartimento di Economia
Facoltà di Economia "G. Fuà"
Ancona
More information about the Gretl-devel
mailing list