rmvnorm {oeli}R Documentation

Draw from multivariate normal distribution

Description

This function draws from a multivariate normal distribution.

Usage

rmvnorm(n = 1, mean, Sigma, log = FALSE)

Arguments

n

An integer, the number of samples.

mean

A numeric, the mean vector of length p.

Sigma

A matrix, the covariance matrix of dimension p x p.

log

A logical, if TRUE the draw is taken from the log-normal distribution. By default, log = FALSE.

Value

If n = 1 a vector of length p, else a matrix of dimension n times p with samples as rows.

Examples

mean <- c(0, 0)
Sigma <- diag(2)
rmvnorm(n = 3, mean = mean, Sigma = Sigma)
rmvnorm(mean = mean, Sigma = Sigma, log = TRUE)


[Package oeli version 0.5.2 Index]