Normal (Gaussian) Distribution

DESCRIPTION:

Density, cumulative probability, quantiles and random generation for the normal (also called Gaussian) distribution.

USAGE:

dnorm(x, mean=0, sd=1, log=F)
pnorm(q, mean=0, sd=1, lower.tail=TRUE, log.p=FALSE)
qnorm(p, mean=0, sd=1)
rnorm(n, mean=0, sd=1, bigdata=F)

REQUIRED ARGUMENTS:

x
vector or bdVector of quantiles. Missing values ( NAs) are allowed.
q
vector or bdVector of quantiles. Missing values ( NAs) are allowed.
p
vector or bdVector of probabilities. Missing values ( NAs) are allowed.
n
sample size. If length(n) is larger than 1, then length(n) random values are returned.

OPTIONAL ARGUMENTS:

mean
vector or bdVector of means. This is replicated to be the same length as p or q or the number of deviates generated.
sd
vector or bdVector of (positive) standard deviations. This is replicated to be the same length as p or q or the number of deviates generated.
bigdata
a logical value; if TRUE, an object of type bdVector is returned. Otherwise, a vector object is returned. This argument can be used only if the bigdata library section has been loaded.
log
a logical scalar; if TRUE, dnorm will return the log of the density, not the density itself.
lower.tail
a logical scalar; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].
log.p
a logical scalar; if TRUE, probabilities p are given as log(p). Default is FALSE.

VALUE:

density ( dnorm), probability ( pnorm), quantile ( qnorm), or random sample ( rnorm) for the normal distribution with mean and standard deviation parameters mean and sd.

SIDE EFFECTS:

The function rnorm causes creation of the dataset .Random.seed if it does not already exist, otherwise its value is updated.

DETAILS:

Elements of q or p that are missing will cause the corresponding elements of the result to be missing.

The ratio of uniform deviates is used by rnorm to generate normal deviates (Kinderman and Monahan, 1977). The average number of uniform deviates used per normal deviate is 8/sqrt(exp(1)*pi) which is about 2.74.

BACKGROUND:

The Gaussian or normal distribution is the most widely used in Statistics. It is real valued and symmetric about mean. There are two major reasons for the dominance of the Gaussian distribution. The first is that the mathematics tend to be relatively simple, and the second is that often the random mechanism can be specified as approximately Gaussian due to the Central Limit Theorem. The simplest Central Limit Theorem states that the average of independent and identically distributed random variables whose variances exist approaches the Gaussian distribution as the number of random variables in the average goes to infinity. The result can still be true when these assumptions are loosened in various ways.

For details on the uniform random number generator implemented in S-PLUS, see the set.seed help file.

REFERENCES:

Johnson, N. L. and Kotz, S. (1970). Continuous Univariate Distributions, vol. 1. Houghton-Mifflin, Boston.

Kinderman, A. J. and Monahan, J. F. (1977). Computer generation of random variables using the ratio of uniform deviates. ACM Transactions on Mathematical Software. 3 257-260.

SEE ALSO:

, , , , , , .

EXAMPLES:

rnorm(20, 0, 10) # sample of 20, mean 0, standard dev. 10

# Generate a 20x5 matrix of independent Gaussians:
matrix(rnorm(20*5), nrow=20) # one way
rmvnorm(20, d=5)             # another