help _grndraw()P. Van Kerm (May 2017)

Title

egen rndraw -- Random number generation from the GB2, Singh-Maddala, Dagum, Fisk and Pareto distributions

Syntax

egen [type] newvar = rndraw() [if] [in]
,
{pareto(# #) | fisk(# #) | loglogistic(# #) | sm(# # #) | dagum(# # #) | gb2(# # # #)}

Description

egen rndraw generates a new variable newvar (of the optionally specified storage type) filled with random values drawn from one of five possible distributions: the Pareto distribution, the Fisk (or log-logistic) distribution,
the Singh-Maddala distribution, the Dagum distribution or the Generalized Beta distribution of the Second Kind (GB2). Kleiber and Kotz (2003) provide a thorough analysis of these distributions; also see Jenkins (2004) and McDonald (1984).

Simulation is based on standard inverse transform sampling methods. runiform() is used to generate pseudo-random draws from a uniform distribution
which are then mapped onto draws from the chosen distribution through its quantile function.

The four-parameter GB2 distribution has density

f(x) = ax^(ap-1)*{(b^(ap))*B(p,q)*[1 + (x/b)^a ]^(p+q)}^-1

where a, b, p, q are strictly positive parameters and B() is the Beta distribution. b is a scale parameter while a, p, q are shape parameters; a determines the overall shape, p drives the left tail and q the right tail.

The Singh-Maddala, Dagum and Fisk distributions can be derived from the GB2.
The Singh-Maddala distribution is obtained with p=1; the Dagum with q=1 and the Fisk distribution with p=q=1.

The Pareto distribution has density

f(x) = a*(x0^a)*x^(-a-1)

where a is a positive shape parameter and x0 is a scale parameter

Options

gb2(numlist) selects the Genralized Beta Distribution of the Second Kind; it requires four values in numlist for specifying parameters a, b, p and q.

sm(numlist) selects the Singh-Maddala distribution; it requires three values in numlist for specifying parameters a, b and q.

dagum(numlist) selects the Dagum distribution; it requires three values in numlist for specifying parameters a, b and p.

fisk(numlist) selects the Fisk distribution (also known as a log-logistic distribution); it requires two values in numlist for specifying parameters a and b.

loglogistic(numlist) is equivalent to fisk(numlist).

pareto(numlist) selects a Pareto distribution; it requires two values in numlist for specifying parameters x0 and a.

Only one option can be specified.

Examples

. set obs 1000

. egen double ysm = rnddraw() , sm(5 100 1.2)

. egen double ygb2 = rnddraw() , gb2(5 100 0.8 1.2)

. egen double ypareto = rnddraw() , pareto(100 2.5)

. graph twoway (kdensity ysm) (kdensity ygb2) (kdensity ypareto)

References

Jenkins, S.P. (2004). Fitting functional forms to distributions, using ml. Presentation at Second German Stata Users Group Meeting, Berlin.

Kleiber, C. and Kotz, S. (2003). Statistical Size Distributions in Economics and Actuarial Sciences. Hoboken, NJ: John Wiley.

McDonald, J.B. (1984). Some generalized functions for the size distribution of income. Econometrica 52: 647-663.

Author

Philippe Van Kerm, Luxembourg Institute of Socio-Economic Research & University of Luxembourg, philippe.vankerm@liser.lu

Citation

Van Kerm, P. (2017). rnddraw - Random number generation from the GB2, Singh-Maddala, Dagum, Fisk and Pareto distributions,
Statistical Software Components S458349, Boston College Department of Economics. Available from
http://ideas.repec.org/c/boc/bocode/s458349.html.

Acknowledgements

This package has been developed in the framework of the SimDeco project (Tax-benefit systems, employment structures and cross-country differences in income inequality in Europe: a micro-simulation approach)
supported by the Luxembourg Fonds National de la Recherche (grant C13/SC/5937475).

Also see

User-written commands:
gb2fit,
smfit,
dagumfit,
fiskfit,
paretofit