rGaussian: Random generation for Gaussian distribution

Description Usage Arguments Value See Also Examples

View source: R/Gaussian_Inference.r

Description

Generate random samples from a Gaussian distribution. For a random vector x, the density function of a (multivariate) Gaussian distribution is defined as:

sqrt(2 pi^p |Sigma|)^{-1} exp(-1/2 (x-mu )^T Sigma^{-1} (x-mu))

where p is the dimension of x.

Usage

1
rGaussian(n, mu, Sigma = NULL, A = NULL)

Arguments

n

integer, number of samples.

mu

numeric, mean vector.

Sigma

matrix, covariance matrix, one of Sigma and A should be non-NULL.

A

matrix, the Cholesky decomposition of Sigma, an upper triangular matrix, one of Sigma and A should be non-NULL.

Value

A matrix of n rows and length(mu) columns.

See Also

dGaussian

Examples

1
2
x <- rGaussian(1000,mu = c(1,1),Sigma = matrix(c(1,0.5,0.5,3),2,2))
plot(x)

bbricks documentation built on July 8, 2020, 7:29 p.m.