EllDistrSim {ElliptCopulas}R Documentation

Simulation of elliptically symmetric random vectors

Description

This function uses the decomposition X=μ+RAUX = \mu + R * A * U where μ\mu is the mean of XX, RR is the random radius, AA is the square-root of the covariance matrix of XX, and UU is a uniform random variable of the d-dimensional unit sphere. Note that RR is generated using the Metropolis-Hasting algorithm.

Usage

EllDistrSim(
  n,
  d,
  A = diag(d),
  mu = 0,
  density_R2,
  genR = list(method = "pinv")
)

Arguments

n

number of observations.

d

dimension of XX.

A

square-root of the covariance matrix of XX.

mu

mean of XX. It should be a vector of size d.

density_R2

density of the random variable R2R^2, i.e. the density of the X22||X||_2^2 if μ=0\mu=0 and AA is the identity matrix. Note that this function must return 00 for negative inputs.

genR

additional arguments for the generation of the squared radius. It must be a list with a component method:

  • If genR$method == "pinv", the radius is generated using the function Runuran::pinv.new().

  • If genR$method == "MH", the generation is done using the Metropolis-Hasting algorithm, with a N(0,1)N(0,1) move at each step.

Value

a matrix of dimensions (n,d) of simulated observations.

See Also

EllCopSim for the simulation of elliptical copula samples, EllCopEst for the estimation of elliptical distributions, EllDistrSimCond for the conditional simulation of elliptically distributed random vectors given some observe components.

Examples

# Sample from a 3-dimensional normal distribution
X = EllDistrSim(n = 200, d = 3, density_R2 = function(x){stats::dchisq(x=x,df=3)})
plot(X[,1], X[,2])
X = EllDistrSim(n = 200, d = 3, density_R2 = function(x){stats::dchisq(x=x,df=3)},
                genR = list(method = "MH", niter = 500))
plot(X[,1], X[,2])
# Sample from an Elliptical distribution for which the squared radius
# follows an exponential distribution
cov1 = rbind(c(1,0.5), c(0.5,1))
X = EllDistrSim(n = 1000, d = 2,
                A = chol(cov1), mu = c(2,6),
                density_R2 = function(x){return(exp(-x) * (x > 0))} )


[Package ElliptCopulas version 0.1.3 Index]