multi_rnorm: Generate Correlated Normal Random Numbers

View source: R/RcppExports.R

multi_rnormR Documentation

Generate Correlated Normal Random Numbers

Description

Generate random numbers from a multivariate normal distribution. It can be used to create correlated random numbers.

Usage

multi_rnorm(n, mean, sd)

Arguments

n

The number of samples desired for each variable.

mean

A vector giving the mean of each variable.

sd

A valid covariance matrix.

Value

A matrix with n rows and as many columns as mean values.

Examples

mus <- c(0, 3, 5)
sigmas <- matrix(c(1, 0.265, 2.19, 0.265, 0.25, 0.66, 2.19, 0.66, 9), ncol = 3)
mat <- multi_rnorm(100, mus, sigmas)
var(mat)

colorednoise documentation built on May 29, 2024, 9:21 a.m.