mvrnorm_cpp {hdbcp}R Documentation

Multivariate Normal Random Number Generator

Description

Generates random numbers from a multivariate normal distribution with specified mean and covariance matrix using a C++ implementation.

Usage

mvrnorm_cpp(n = 1, mu, Sigma)

Arguments

n

The number of random samples to generate. Defaults to 1.

mu

The mean vector of the distribution.

Sigma

The covariance matrix of the distribution.

Value

A numeric matrix where each row is a random sample from the multivariate normal distribution.

Examples

# Example usage
mu <- c(0, 0)
Sigma <- matrix(c(1, 0.5, 0.5, 1), 2, 2)
mvrnorm_cpp(5, mu, Sigma)


[Package hdbcp version 1.0.0 Index]