[Gretl-users] Create a random variable

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Sun Nov 27 13:23:28 EST 2011

On Sun, 27 Nov 2011, Carlos Andrade wrote:

> Gretl List
> How to generate a random variable for a given range of values?
> Example: 46 observations between 0 and 45.

There are several ways, but the main difference is: with repetiton or not? 
Have a look at this:

nulldata 46

#with repetition
series x = floor(uniform(0,46))

#without repetition
matrix tmp = muniform(46,1) ~ seq(0,45)'
series z = msortby(tmp,1)[,2]

Hope this helps,

Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti at univpm.it

More information about the Gretl-users mailing list