{smcl} {* 15 March 2004}{...} {hline} help for {hi:nirand} {right:Peter Lachenbruch program} {hline} {title:Generate random variables from N/I distributions} {p 8 17 2} {cmdab:nirand} {it:newvar} [{cmd:if} {it:exp}] [{cmd:in} {it:range}] [{cmd:,} [ {cmd:i} | {cmdab:u:niform} | {cmdab:v:mix} | {cmdab:n:ormal} | {cmdab:m:mix} | {cmd:c(}{it:#}{cmd:)} ] {cmd:m1(}{it:#}{cmd:)} {cmd:s1(}{it:#}{cmd:)} {cmd:alpha(}{it:#}{cmd:)} {cmd:m2(}{it:#}{cmd:)} {cmd:s2(}{it:#}{cmd:)} ] {title:Description} {p 4 4 2}{cmd:nirand} generates random variables from the normal/independent family, usually ratios of a normal to an independent random variable. The numerator distribution will typically be a normal distribution with mean {cmd:m1} (default 0) and standard deviation {cmd:s1} (default 1), but optionally could be a mixture of two normals. The denominator may be specified by an option: it defaults to {cmd:I}. {p 4 4 2} {hi:You must set the number of observations before entering the program.} {title:Options} {p 4 4 2}Only one of {cmd:i}, {cmd:uniform}, {cmd:vmix} {cmd:normal} {cmd:mmix} and {cmd:c()} may be specified. {p 4 8 2}{cmd:i} specifies that the denominator distribution is a point mass of 1, leading to a normal random variable as output. This is the default, so the option is unnecessary. {p 4 8 2}{cmd:uniform} specifies that the denominator distribution is uniform(0,1), leading to the slash distribution (with very long tails) as output. {p 4 8 2} {cmd:vmix} specifies that the distribution is a {hi:mixture} of a normal distribution with mean m1 and standard deviation s1 and a {hi:slash} distribution with m2 and s2. {p 4 8 2}{cmd:normal} specifies that the denominator is normal(0,1), leading to a Cauchy distribution as output. {p 4 8 2} {cmd:mmix} specifies that the distribution is a {hi:mixture} of a normal distribution with mean m1 and standard deviation s1 and a {hi:Cauchy} distribution with m2 and s2 {p 4 8 2} {cmd:c()} specifies that the denominator distribution is the square root of a chi-square with {it:#} df leading to a (possibly non-central) {it:t} distribution with {it:#} df as output. {it:#} need not be an integer. {p 4 8 2}{cmd:m1()} specifies the mean of the numerator distribution. The default is 0. {p 4 8 2}{cmd:s1()} specifies the standard deviation of the numerator distribution. The default is 1. {p 4 4 2}Note that the inverse of any of the denominator distributions may be obtained by specifying {cmd:m1(1) s1(0)} and omitting {cmd:alpha()}, {cmd:m2()} and {cmd:s2()}. {p 4 8 2}{cmd:alpha()} specifies that the numerator distribution will be an {it:#} : (1 - {it:#}) mixture of two normal distributions. {it:#} must be between 0 and 1. The second component will be normal with mean given by {cmd:m2()} and standard deviation given by {cmd:s2()}. Hence if {cmd:alpha()} is specified, so too must be {cmd:m2()} and {cmd:s2()}. {p 4 8 2}{cmd:m2()} specifies the mean of the second component of the numerator distribution. See {cmd:alpha()} above. {p 4 8 2}{cmd:s2()} specifies the standard deviation of the second compoment of the numerator distribution. See {cmd:alpha()} above. {title:Examples} {p 4 8 2}A normal(10, 1):{p_end} {p 4 8 2}{inp:. nirand normal, i m1(10) s1(1)} {p 4 8 2}A slash:{p_end} {p 4 8 2}{inp:. nirand slash, uniform} {title:References} {p 4 4 2} Kafadar, K. 2003. John Tukey and robustness. {it:Statistical Science} 18(3): 319-331. {p 4 4 2} Hilbe, J. STB-28 sg44 for various random number generating programs {title:Author} {p 4 4 2}Peter A. Lachenbruch FDA/CBER/OBE{break} peter.lachenbruch@fda.hhs.gov