Learn R Programming

rags2ridges (version 2.2.6)

rmvnormal: Multivariate Gaussian simulation

Description

Fast simulation from multivariate Gaussian probability distribution.

Usage

rmvnormal(n, mu, sigma)

Value

Returns a \(n\) by \(p\) matrix of observations from a multivariate normal distribution with the given mean mu and covariance

Arguments

n

An integer giving the number of observations to be simulated.

mu

A numeric vector of dimension \(p\) giving the means of normal distribution.

sigma

A variance-covariance matrix of dimension \(p\) times \(p\).

Author

Anders Ellern Bilgrau

Details

The rmvnormal function is copied from the GMCM-package. It is similar to rmvnorm from the mvtnorm-package.

Examples

Run this code

rmvnormal(n = 10, mu = 1:4, sigma = diag(4))

Run the code above in your browser using DataLab