next up previous contents
Next: Maintaining your S/R Objects Up: Splus/R Previous: Matrices   Contents


Random Data

Although both R and S-plus are multifarious in their use, they are statistical programming languages at their core. As such, both have excellent random number generators for a wide variety of probability distributions, continuous and discrete. Some of the more common distributions include the Normal, Student's T, Binomial, Uniform, Poisson, Chi-square, Cauchy, and the Logistic. Several of the more obscure distributions which are available are the Wilcoxon Signed Rank Statistic, the Wilcoxon Rank Sum Statistic, and Tukey's Studentized Range Distribution. Many others exist and can be found by searching the help manuals for ``distribution'', $ i.e.$ ?Normal at the software's prompt.

Each distribution has four functions available for different tasks associated with the probability distribution: evaluation of the density (or mass function), the distribution function, the quantile function, and random number generation. For example, the functions associated with the Normal distribution are dnorm(), pnorm(), qnorm(), and rnorm(). Obviously, the arguments associated with these functions are different and the use of the args() command is quite useful when implementing any of the above. To see the arguments for generating random data, we see from args(), that rnorm() needs the number of variates you wish to generate, n, and that the default distribution is standard normal.

> args(rnorm)
function (n, mean = 0, sd = 1) 
NULL


next up previous contents
Next: Maintaining your S/R Objects Up: Splus/R Previous: Matrices   Contents
Computer Support Group 2002-10-07