Learn R Programming

copBasic (version 1.5.1)

simCOP: Simulate a Copula by Numerical Derivative Method

Description

Perform a simulation and visualization of a copula by numerical derivatives of the copula.

Usage

simCOP(n=100, cop=NULL, para=NULL, ploton=TRUE, points=TRUE, ...)

Arguments

n
A sample size, default is 100;
cop
A copula function;
para
Vector of parameters, if needed, to pass to the copula;
ploton
A logical to toggle on the plot;
points
A logical to actually draw the simulations by points(); and
...
Additional arguments to pass to the points() function.

Value

  • A data frame of the simulated values is returned.

References

Nelson, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.

See Also

derCOPinv

Examples

Run this code
simCOP(cop=W)                  # Frechet lower bound
simCOP(n=10, cop=P)            # Independence copula
simCOP(cop=M, col=2)           # Frechet upper bound
simCOP(cop=PSP)                # The PSP copula
simCOP(cop=P, cex=0.5, pch=16) # Independence copula

# Now simulate the PSP copula, add the level curves of the
# copula, and demonstrated the uniform distribution of the
# marginals on the correct axes (top for U and bottom for V).
D <- simCOP(n=400, cop=PSP) # store simulated values in D
level.curvesCOP(cop=PSP, ploton=FALSE)
rug(D$U, side=3, col=2); rug(D$V, side=4, col=2)


# Now let us get more complicated and mix two Plackett copulas
# together using the composite2COP as a "compositor." The
# parameter argument becomes more complex, but is passed as
# shown into composite2COP.
para <- list(cop1=PLACKETTcop, cop2=PLACKETTcop,
             alpha=0.3, beta=0.5, para1=0.1, para2=50)
D <- simCOP(n=450, cop=composite2COP,
            para=para, col=rgb(0,0,0,0.1), pch=16)

Run the code above in your browser using DataLab