rcontmnorm {bifurcatingr}R Documentation

Contaminated Normal Generator

Description

This function generates contaminated multivariate normal errors that are used in the generation of the Bifurcating autoregressive tree.

Usage

rcontmnorm(
  n,
  d = 2,
  mu1 = rep(0, d),
  sigma1 = diag(d),
  mu2 = rep(0, d),
  sigma2 = diag(d),
  g
)

Arguments

n

sample size

d

dimension. Defaults to 2 for bivariate normal errors.

mu1

mean vector for first multivariate normal distribution. Defaults to the zero vector.

sigma1

variance-covariance matrix for first multivariate normal distribution. Defaults to the d by d identity matrix, where d is the dimension.

mu2

mean vector for second multivariate normal distribution. Defaults to the zero vector.

sigma2

variance-covariance matrix for second multivariate normal distribution. Defaults to the d by d identity matrix, where d is the dimension.

g

proportion of contamination. Defaults to zero producing non-contaminated multivariate normal data.

Value

An n by d contaminated multivariate normal matrix.

Examples

#Non-contaminated bivariate normal:
rcontmnorm(10, sigma2=2^2*matrix(c(1,0,0,1),nrow=2) , g=0)
#Contaminated bivariate normal with 20% contamination:
rcontmnorm(10, sigma2=2^2*matrix(c(1,0,0,1),nrow=2) , g=0.2)

[Package bifurcatingr version 2.1.0 Index]