Learn R Programming

copBasic (version 1.5.1)

EMPIRsimv: Simulate an Empirical Copula For a Fixed Value of U

Description

Perform a simulation on an empirical copula to extract the variates $V$ from a given and fixed value for $u=$constant. The purpose of this function is to return a simple vector of the $V$ simulations. This behavior differs from that in EMPIRsim and by simCOP; these later two functions generate data frames of simulated $U$ and $V$ and optional graphics as well.

For the situation in which $u$ is not a value on the grid, then the bounding conditional quantile functions are solved for each of the $n$ simulations and the following interpolation is made. $$v = \frac{v_1/w_1 + v_2/w_2}{1/w_1 + 1/w_2}$$ which states that that the weighted mean is computed. The values $v_1$ and $v_2$ are ordinates of the conditional quantile function at for the grid lines to the left and right of the $u$ value. The value $w_1$ $=$ $u - u^\mathrm{left}_\mathrm{grid}$, and the value $w_2$ $=$ $u^\mathrm{right}_\mathrm{grid} - u$.

Usage

EMPIRsimv(u, n=1, empgrid=NULL, kumaraswamy=FALSE, ...)

Arguments

u
The fixed probability $u$ on which to perform conditional simulation for a sample of size $n$;
n
A sample size, default is 1;
empgrid
Gridded empirical copula from EMPIRgrid;
kumaraswamy
A logical to trigger Kumaraswamy smoothing of the conditional quantile function that is passed to EMPIRgridderinv;
...
Additional arguments to pass.

Value

  • A vector of simulated $V$ values is returned.

See Also

EMPIRgrid, EMPIRsim

Examples

Run this code
nsim <- 3000
para   <- list(alpha=.15,  beta=.65,
               cop1=PLACKETTcop, cop2=PLACKETTcop,
               para1=.005, para2=1000)
set.seed(1)
uv <- simCOP(n=nsim, cop=composite2COP, para=para,
             pch=16, col=rgb(0,0,0,.2))
set.seed(1) # try not resetting the seed
uv.grid <- EMPIRgrid(para=uv, deluv=.1)
V <- EMPIRsimv(u=0.6, n=nsim, empgrid=uv.grid)

invgrid <- EMPIRgridderinv(empgrid=uv.grid)
att <- attributes(invgrid)
kur <- att$kumaraswamy
Vsim <- rlmomco(nsim, vec2par(c(kur$Alpha[7], kur$Beta[7]), type="kur"))

print(summary(V)) # kumaraswamy not core in QDF reconstruction
print(summary(Vsim)) # use of the kumaraswamy

# continuing
set.seed(1) # try not resetting the seed
nsim <- 5000
V <- EMPIRsimv(u=0.74, n=nsim, empgrid=uv.grid)
set.seed(1) # try not resetting the seed
V1 <- rlmomco(nsim, vec2par(c(kur$Alpha[8], kur$Beta[8]), type="kur"))
set.seed(1) # try not resetting the seed
V2 <- rlmomco(nsim, vec2par(c(kur$Alpha[9], kur$Beta[9]), type="kur"))
plot(pp(V), sort(V), type="l", lwd=4, col=8)
lines(pp(V1), sort(V1), col=2, lwd=2)
lines(pp(V2), sort(V2), col=3, lwd=2)

W1 <- 0.74 - 0.7; W2 <- 0.8 - 0.74
Vblend <- (V1/W1 + V2/W2) / sum(1/W1 + 1/W2)
lines(pp(Vblend), sort(Vblend), col=4, lwd=2) # BLUE LINE

# Notice how the grey line and the blue diverge for F < 0.1
# and F > 0.9. These are the limits of the grid spacing and
# linear interpolation within the grid resolution is being
# used and not direct simulation from the kumaraswamy.

Run the code above in your browser using DataLab