vuSim: Bernstein copula simulation of a bivariate uniform...

Description Usage Arguments Value Author(s) References Examples

View source: R/vuSim.R

Description

Bernstein copula simulation of a bivariate uniform distribution. The bivariate uniform distribution can be a transformed one from non-uniform data.

Usage

1
vuSim(n = 100, diffEC, v = NULL, t = NULL, delta = 0, ...)

Arguments

n

An integer specifying the number of simulations required.

diffEC

Forward difference with respect of $y$ of the empirical copula matrix. Maybe computed with forwardDifference of empiricalCDF2Dcounts. empiricalCDF2Dcounts.

v

Non-exceedance probabilities used for conditional simulation. Default to NULL, but if specified, then n = length(v).

t

Numeric value in [0,1] for repreducible research.

delta

Numeric scalar. Ideally must be zero, but it is used for numerical computation stability, say, .Machine$double.eps^0.07.

...

Further arguments passed to uniroot.

Value

A 2-columns matrix of simulated pseudo-observations u,v.

Author(s)

Francisco Mendoza-Torres (mentofran@gmail.com)

References

Section 5.3 of the book 'Simulating copulas' computed by the derivative in Eq. 5.23 of the Book of "Goldman, 2002, Pyrimid algorithms..." (the same as eq 7.15 of "phillips, 2003, Interpolation and Approximation...")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Common to Examples 1, 2 and 3
en <- 100
library(copBasic)
set.seed(123); eu <- runif(en)
ev <- simCOPv(u = eu, cop=PLACKETTcop, para=20.1, snv=F) # simulate strong positive Plackett
plot.default(eu, ev, asp = 1, xlim = 0:1, ylim = 0:1, main = "data")
library(empiricalDistribution)
empCopulaCountsmatrix <- empiricalCDF2Dcounts(data.frame(U=eu, V=ev))
fDiffEmpCopMatrix <- forwardDifference(empCopulaCountsmatrix, i = 2)
library(inverseFunction)

# Example 1 (n is given):
evMySim1 <- vuSim(n = en, diffEC = fDiffEmpCopMatrix)
plot.default(evMySim1, asp = 1, xlim = 0:1, ylim = 0:1, main = "Ex1")

# Example 2 (u is given):
evMySim2 <- vuSim(n = en, diffEC = fDiffEmpCopMatrix, v = ev)
plot.default(evMySim2, asp = 1, xlim = 0:1, ylim = 0:1, main = "Ex2")

# Example 3 (Reproducible Research, u and t are given):
et <- evMySim2[, 3]
evMySim3 <- vuSim(n = 100, diffEC = fDiffEmpCopMatrix, v = ev, t = et)
all.equal(evMySim2, evMySim3)
plot.default(evMySim3, asp = 1, xlim = 0:1, ylim = 0:1, main = "Ex3")

mathphysmx/bernstein documentation built on Sept. 3, 2019, 12:57 p.m.