dmvnorm: Multivariate Normal (Gaussian) distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/MultivariateFuncs.R

Description

The mean of the distribution may be a d-dimensional vector. The covariance matrix should be given as a d x d non-negative definite matrix if supplied with the parameter cov. It can also be given, if cov is missing, by a vector sd for the marginal standard deviations and a scalar rho implying a constant correlation between all the marginals. If the covariance structure of the marginals is supplied in this way, sd should be a d-dimensional vector, and rho should be scalar. The dimension d may be inferred from other arguments. The code of this function is a mere wrapper for the function with the same name from the library mvtnorm. It was written to provide compatibility with S-Plus, hence the long list of parameters

Usage

1
2
3
4
5
dmvnorm(x, mean = rep(0, d), cov = diag(d), sd, rho, d = 2, sigma = cov, log = FALSE)

pmvnorm(x, mean = rep(0, d), cov = diag(d), sd, rho, d = 2, sigma = cov, log = FALSE)

rmvnorm(n, mean = rep(0, d), cov = diag(d), sd, rho, d = 2, sigma = cov, log = FALSE)

Arguments

n

Number of samples generated by rmvnorm

x

n x d numeric matrix, each row giving a point at which the density is computed

mean

d- dimensional vector giving the mean of the distribution

cov

d x d matrix giving the covariance matrix of the distribution

sd

d- vector of the marginal standard deviations

rho

number giving the constant correlation when the covariance matrix is given by its diagonal and the parameter rho

d

dimension of the distribution

sigma

used for compatibility with S-Plus

log

boolean for logarithmic scale

method

String giving the method SVD or Choleski used

Details

dmvnorm,compute multivariate normal density. pmvnorm compute multivariate normal c.d.f. rmvnorm generate random samples from the multivariate normal distribution.

Value

A list of the elements

$x

n x d Matrix giving the values where the density is computed

$y

Vector of length n giving the values of the density

Author(s)

Rene Carmona

References

library Rmetrics and S-Plus manual

See Also

dnorm

Examples

1
2
3
4
5
## Not run: 
TSAMPLE <- rmvnorm(n=128, mean=rep(0,2), sd=rep(1,2), rho=.18) 
TDENS <- kdest(TSAMPLE[,1], TSAMPLE[,2]) 

## End(Not run)

Rsafd documentation built on May 31, 2017, 3:14 a.m.