EMPIRsim | R Documentation |
EXPERIMENTAL—Perform a simulation on a bivariate empirical copula to produce the random variates U
and V
and return an R data.frame
of them. The method is more broadly known as conditional simulation method. This function is an empirical parallel to simCOP
that is used for parametric copulas. If circumstances require conditional simulation of V{\mid}U
, then function EMPIRsimv
, which produces a vector of V
from a fixed u
, should be used.
For the usual situation in which an individual u
during the simulation loops is not a value aligned on the grid, then the bounding conditional quantile functions are solved for each of the n
simulations and the following interpolation is made by
v = \frac{v_1/w_1 + v_2/w_2}{1/w_1 + 1/w_2}\mbox{,}
which states that that the weighted mean is computed. The values v_1
and v_2
are ordinates of the conditional quantile function for the respective grid lines to the left and right of the u
value. The values w_1
=
u - u^\mathrm{left}_\mathrm{grid}
and w_2
=
u^\mathrm{right}_\mathrm{grid} - u
.
EMPIRsim(n=100, empgrid=NULL, kumaraswamy=FALSE, na.rm=TRUE, keept=FALSE,
graphics=TRUE, ploton=TRUE, points=TRUE, snv=FALSE,
infsnv.rm=TRUE, trapinfsnv=.Machine$double.eps, ...)
n |
A sample size, default is 100; |
empgrid |
Gridded empirical copula from |
kumaraswamy |
A logical to trigger Kumaraswamy distribution smoothing of the conditional quantile function that is passed to |
na.rm |
A logical to toggle the removal of |
keept |
Keep the |
graphics |
A logical that will disable graphics by setting |
ploton |
A logical to toggle on the plot; |
points |
A logical to actually draw the simulations by the |
snv |
A logical to convert the |
infsnv.rm |
A logical that will quietly strip out any occurrences of |
trapinfsnv |
If |
... |
Additional arguments to pass to the |
An R data.frame
of the simulated values is returned.
W.H. Asquith
EMPIRgrid
, EMPIRgridderinv
, EMPIRsimv
# See other examples under EMPIRsimv
## Not run:
pdf("EMPIRsim_experiment.pdf")
nsim <- 5000
para <- list(alpha=0.15, beta=0.65,
cop1=PLACKETTcop, cop2=PLACKETTcop, para1=0.005, para2=1000)
set.seed(1)
uv <- simCOP(n=nsim, cop=composite2COP, para=para, snv=TRUE,
pch=16, col=rgb(0,0,0,.2))
mtext("A highly complex simulated bivariate relation")
# set.seed(1) # try not resetting the seed
uv.grid <- EMPIRgrid(para=uv, deluv=0.025)
uv2 <- EMPIRsim(n=nsim, empgrid=uv.grid, kumaraswamy=FALSE, snv=TRUE,
col=rgb(1,0,0,0.1), pch=16)
mtext("Resimulation without Kumaraswamy smoothing")
uv3 <- EMPIRsim(n=nsim, empgrid=uv.grid, kumaraswamy=TRUE, snv=TRUE,
col=rgb(1,0,0,0.1),pch=16)
mtext("Resimulation but using the Kumaraswamy Distribution for smoothing")
dev.off()#
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.