rmcd: Simulate from a Multivariate Cauchy Distribution

View source: R/rmcd.R

rmcdR Documentation

Simulate from a Multivariate Cauchy Distribution

Description

Produces one or more samples from the multivariate (p variables) Cauchy distribution (MCD) with location parameter mu and scatter matrix Sigma.

Usage

rmcd(n, mu, Sigma, tol = 1e-6)

Arguments

n

integer. Number of observations.

mu

length p numeric vector. The location parameter.

Sigma

symmetric, positive-definite square matrix of order p. The scatter matrix.

tol

tolerance for numerical lack of positive-definiteness in Sigma (for mvrnorm, see Details).

Details

A sample from a MCD with parameters \boldsymbol{\mu} and \Sigma can be generated using:

\displaystyle{\mathbf{X} = \boldsymbol{\mu} + \frac{\mathbf{Y}}{\sqrt{u}}}

where \mathbf{Y} is a random vector distributed among a centered Gaussian density with covariance matrix \Sigma (generated using mvrnorm) and u is distributed among a Chi-squared distribution with 1 degree of freedom.

Value

A matrix with p columns and n rows.

Author(s)

Pierre Santagostini, Nizar Bouhlel

See Also

dmcd: probability density of a MCD.

Examples

mu <- c(0, 1, 4)
sigma <- matrix(c(1, 0.6, 0.2, 0.6, 1, 0.3, 0.2, 0.3, 1), nrow = 3)
x <- rmcd(100, mu, sigma)
x
apply(x, 2, median)


mcauchyd documentation built on May 29, 2024, 2:21 a.m.