[Gretl-users] randgen question

Allin Cottrell cottrell at wfu.edu
Tue Nov 17 11:51:40 EST 2009


On Tue, 17 Nov 2009, Talha Yalta wrote:

> On Tue, Nov 17, 2009 at 4:12 PM, Allin Cottrell <cottrell at wfu.edu> wrote:
> >
> > On Tue, 17 Nov 2009, Talha Yalta wrote:
> >
> >> I am trying to perpare a ML tutorial where there are T balls
> >> in a bag with a ratio of P=0.75 black balls and there will be
> >> 250 independent trials where 0<X<10 randomly chosen balls
> >> from the bag will show Y blacks.
> >> I create a new data set with 250 observations and create X
> >> with genr X = floor(randgen(u,0,11)
> >> After this, however, the command genr Y = randgen(b,0.75,X)
> >> does not work. Any suggestions?
> >
> > Giving a series for the third argument is not supported.
> I see but is it possible to do what I am trying to do in gretl?

nulldata 250
X = floor(randgen(u,0,11))
series Y
series tmp
loop i=1..250
  if X[i] = 0
    Y[i] = 0
  else
    tmp = randgen(b,0.75,X[i])
    Y[i] = tmp[1]
  endif
endloop

Allin Cottrell


More information about the Gretl-users mailing list