heavy (version 0.38.196)

rmcnorm: Multivariate Contaminated Normal Random Deviates

Description

Random number generation from the multivariate contaminated normal distribution.

Usage

rmcnorm(n = 1, center = rep(0, nrow(Scatter)), Scatter = diag(length(center)),
  epsilon = 0.05, vif = 0.25)

Arguments

n

the number of samples requested

center

a vector giving the locations of each variable

Scatter

a positive-definite dispersion matrix

epsilon, vif

percentage of outliers contamination and variance inflation factor

Value

If n = 1 a vector of the same length as center, otherwise a matrix of n rows of random vectors.

Details

The function rmcnorm is an interface to C routines, which make calls to subroutines from LAPACK. The matrix decomposition is internally done using the Cholesky decomposition. If Scatter is not non-negative definite then there will be a warning message.

References

Devroye, L. (1986). Non-Uniform Random Variate Generation. Springer-Verlag, New York.

Examples

Run this code
# NOT RUN {
# dispersion parameters
Scatter <- matrix(c(10,3,3,2), ncol = 2)
Scatter

# generate the sample
y <- rmcnorm(n = 1000, Scatter = Scatter, epsilon = .05, vif = .25)

# scatterplot of a random bivariate contaminated normal sample
# with center vector zero and scale matrix 'Scatter'
par(pty = "s")
plot(y, xlab = "", ylab = "")
title("bivariate contaminated normal sample", font.main = 1)
# }

Run the code above in your browser using DataCamp Workspace