GenerateRV.CopApprox: Generates random variates from a copula approximation

Description Usage Arguments Details Value References See Also Examples

Description

Method to sample random variates from an object of class ‘CopApprox’.

Usage

1
2
3
## S3 method for class 'CopApprox'
GenerateRV(obj, n, MH = FALSE, trace = FALSE,
  PDF = NULL, burnin = 500, thinning = 5, ...)

Arguments

obj

object from which to sample.

n

number of items to sample.

MH

logical, should a Metropolis-Hastings algorithm be used to refine the sample? Default is FALSE.

trace

logical, indicating whether the function should be verbose.

PDF

probability density function corresponding to copula used to create obj, only used if MH is TRUE; see ‘Details’.

burnin

the number of burn-in iterations of the MH sampler, only used if MH is TRUE, defaults to 500.

thinning

the thining parameter, only used if MH is TRUE, defaults to 5.

...

not used.

Details

If argument MH is FALSE, the default, random variates are directly sampled from the approximation, as described in Tajvidi and Turlach (2017).

If MH is TRUE, GenerateRV uses additionally a Metropolis-Hastings refinement. It first samples from the approximation, but uses those samples then as proposals in a Metropolis-Hastings algorithm. The latter needs the probability density function of the copula. This density function has either to be passed to the argument PDF, or the copula (stored in argument obj) belonging to the approximation must have the density function (with name ‘pdfCopula’) stored in its environment. In the latter case, the argument PDF can be NULL (its default).

Value

A matrix of dimension n times dim, where dim is the dimension for which the copula approximation was determined.

If MH was TRUE the return value has an attribute called ‘AcceptanceRate’, indicating the fraction of samples that were accepted in the Metropolis-Hastings step. This fraction is based on all burnin + (n-1)*thinning + 1 samples that are initially generated from the approximation.

References

Tajvidi, N. and Turlach, B.A. (2017). A general approach to generate random variates for multivariate copulae, Australian & New Zealand Journal of Statistics. Doi:10.1111/anzs.12209.

See Also

GetApprox

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cop <- NewBEVAsyMixedModelCopula(theta=1, phi=-0.25)
approx1 <- GetApprox(cop)
approx2 <- GetApprox(cop, type = 1)
sample1 <- GenerateRV(approx1, 100)
plot(sample1)
sample2 <- GenerateRV(approx2, 100)
plot(sample2)
sample1 <- GenerateRV(approx1, 50, MH = TRUE, trace = TRUE)
plot(sample1)
sample2 <- GenerateRV(approx2, 50, MH = TRUE)
plot(sample2)

SimCop documentation built on May 2, 2019, 12:34 p.m.