.-
help for random number generators                update from STB-28: sg44
.-                                                    Hilbe/Linde-Zwirble

                                                  Current as of 28Jan1999
Random number generators
------------------------

         Student's t:   ^rndt^ obs df
                         Example: rndt 10000 10

          Chi-square:   ^rndchi^ obs df
                         Example: rndchi 10000 4
                             
                   F:   ^rndf^ obs df_numer df_denom
                         Example: rndf 10000 4 15
                             
          log normal:   ^rndlgn^ obs mean stddev
                         Example: rndlgn 10000 0 0.5
                         
             Poisson:   ^rndpoi^ obs mean
                        ^rndpoix^ [ mu ]
                         Example: rndpoi 10000 4
                                  rndpoix mu
                                  
             Poisson:   ^rndpod^ obs mean dispersion
       (ovedispersed)   ^rndpodx^ [mu], s(#)
                         Example: rndpod 10000 4 1.2
                                  rndpodx mu, s(1.2)
                         
            binomial:   ^rndbin^ obs prob numb
                        ^rndbinx^ [ prob ] den
                         Example: rndbin 10000 0.5 1
                                  rndbinx mu den
                         Note: mu= varaiable with p values
                               den = case denominator (1=binary)
                                  
   negative binomial:   ^rndnbx^ [mu] , k(#)
                         Example: rndnblx mu, k(0.5)
                                              
   
               Gamma:   ^rndgam^ obs shape scale
                        ^rndgamx^ [mu], s(#)
                         Example: rndgam 10000 4 2
                                  rndgamx mu, s(1)
                         Note: s(1) specifies a shape parameter of 1;
                               the scale is calculated from mu*shape
                                   
    inverse Gaussian:   ^rndivg^ obs mean sigma
                        ^rndivgx^ [mu], s(#)
                         Example: rndivg 10000 10 0.05
                                  rndivgx mu, s(0.05)
                         Note: mu = 1/sqrt(eta)
                               variance = sigma^2*mu*3
                               
         exponential:   ^rndexp^ obs shape
                         Example: rndexp 10000 3
                         
             Weibull:   ^rndwei^ obs shape scale
                         Example: rndwei 10000 3 2
                         
       Beta binomial:   ^rndbb^ obs denom prob k
                         Example: 10000 200 0.2 0.05
                         Note: prob= p = a1/(a1+a2)
                               k = dispersion = 1/(a1+a2+1)
          This generator will return beta-binomial random
          deviates within the following constraints. Although
          k can take any value from 0 to 1, in this program
          k is limited because of the volotility of the
          distribution outside this range of k. k must be as
          follows: k< the lessor of p' and (1-p')/2 where p'=p
          if p<0.5, else p'=1-p. This should work well within
          the physical representation of an overdispersed binomial.

Generalized logistic:   ^rndglog^ obs L A T
       (3 parameter)     Example: rndglog 10000 3.0 0.7 4.5
                         Note: L = (long) right hand tail
                               A = (alpha) left hand tail
                               T = (time) position parameter
                         Based on Fit-Meister (W. Linde-Zwirble)

Description
-----------

The programs listed above generate random numbers for a variety of important
distributions.  In the syntax diagrams, ^obs^ indicates the number of 
observations to be generated.  The other parameters are self-explanatory.
Commands whose names end in ^x^ provide the capability to model a complete
synthetic data set.


Examples of Constructing a Data Set
-----------------------------------

Constructed Poisson data set with parameters of:
          _b[0] =   1
          _b[1] =   0.5
          _b[2] =  -0.25

 . ^set obs 50000^                          [data set of size 50,000]
 . ^generate x1 = abs(invnorm(uniform())^   [variable 1]
 . ^generate x2 = abs(invnorm(uniform())^   [variable 2]
 . ^generate lp = 1 + .5*x1 - .25*x2^       [linear predictor]
 . ^generate mu = exp(lp)^                  [inverse link]
 . ^rndpoix mu^

See STB28 (sg44) article for details and other examples.

Contact
-------
        Joseph Hilbe
        Arizona State University 
        hilbe@@asu.edu
     
