either a vector of length d or a matrix with d
columns, where d=ncol(varcov), representing
the coordinates of the point(s) where the density must
be evaluated; for pmnorm, d cannot exceed 20
mean
either a vector of length d, representing the mean value,
or (except for rmnorm) a matrix whose rows represent different
mean vectors; in the matrix case, only allowed for dmnorm and
pmnorm, its dimensions must match those of x
varcov
a symmetric positive-definite matrix representing the
variance-covariance matrix of the distribution;
a vector of length 1 is also allowed (in this case, d=1 is set)
sqrt
if not NULL (default value is NULL),
a square root of the intended varcov matrix;
see ‘Details’ for a full description
log
a logical value (default value is FALSE);
if TRUE, the logarithm of the density is computed
...
parameters passed to sadmvn,
among maxpts, abseps, releps
n
the number of random vectors to be generated
lower
a numeric vector of lower integration limits of
the density function; must be of maximal length 20;
+Inf and -Inf entries are allowed
upper
a numeric vector of upper integration limits
of the density function; must be of maximal length 20;
+Inf and -Inf entries are allowed
maxpts
the maximum number of function evaluations
(default value: 2000*d)
abseps
absolute error tolerance (default value: 1e-6)
releps
relative error tolerance (default value: 0)
Details
The function pmnorm works by making a suitable call to
sadmvn if d>2, or to biv.nt.prob if d=2,
or to pnorm if d=1.
Function sadmvn is an interface to a Fortran-77 routine with
the same name written by Alan Genz, available from his web page,
which works using an adaptive integration method.
This Fortran-77 routine makes uses of some auxiliary functions whose authors
are documented in the code.
If sqrt=NULL (default value), the working of rmnorm involves
computation of a square root of varcov via the Cholesky decomposition.
If a non-NULL value of sqrt is supplied, it is assumed
that it represents a matrix, R say, such that R' R
represents the required variance-covariance matrix of the distribution;
in this case, the argument varcov is ignored.
This mechanism is intended primarily for use in a sequence of calls to
rmnorm, all sampling from a distribution with fixed variance matrix;
a suitable matrix sqrt can then be computed only once beforehand,
avoiding that the same operation is repeated multiple times along the
sequence of calls; see the examples below.
Another use of sqrt is to supply a different form of square root
of the variance-covariance matrix, in place of the Cholesky factor.
For efficiency reasons, rmnorm does not perform checks on the supplied
arguments.
If, after setting the same seed value to set.seed,
two calls to rmnorm are made with the same arguments except that one
generates n1 vectors and the other n2 vectors, with
n1<n2, then the n1 vectors of the first call coincide with the
initial n2 vectors of the second call.
Value
dmnorm returns a vector of density values (possibly log-transformed);
pmnorm returns a vector of probabilities, possibly with attributes
on the accuracy in case x is a vector;
sadmvn return a single probability with
attributes giving details on the achieved accuracy;
rmnorm returns a matrix of n rows of random vectors
or a vector in case n=1.
Note
The attributes error and status of the probability
returned by pmnorm and sadmvn indicate whether the function
had a normal termination, achieving the required accuracy.
If this is not the case, re-run the function with a higher value of
maxpts
Author(s)
Fortran code of SADMVN and most auxiliary functions by Alan Genz,
some additional auxiliary functions by people referred to within his
program. Interface to R and additional R code by Adelchi Azzalini
References
Genz, A. (1992).
Numerical Computation of multivariate normal probabilities.
J. Computational and Graphical Statist., 1, 141-149.
Genz, A. (1993). Comparison of methods for the computation of
multivariate normal probabilities.
Computing Science and Statistics, 25, 400-405.