Learn R Programming

copBasic (version 1.7.1)

simcomposite3COP: Simulation of a Composited Copula

Description

This function simulates, computes L-comoments, and provides plotting features for a composited copula using four compositing parameters (see composite3COP). The compositing parameters are each independent and uniformly distributed: $$\alpha \sim \mathrm{U}[0,1];\ \beta \sim \mathrm{U}[0,1];\ \kappa \sim \mathrm{U}[0,1];\ \gamma \sim \mathrm{U}[0,1]\mbox{.}$$ L-comoment estimation is provided by the lcomoms2 function of the lmomco package. The intention of this function is to provide an interface connecting highly complex copula composition to the L-comoments---that is why the compositing parameters are randomly drawn with each simulation (nsim). This function also provides a mechanism for random parameter generation for the composited copulas. This function is partially misnamed. For example if simulation of nonexceedance probabilities $u$ and $v$ for a known composite copula (the compositing parameters are specified and constant), then the more familiar simCOP function is to be used instead.

Usage

simcomposite3COP(n=1000, nsim=100, compositor=composite3COP,
                 parents=NULL, ploton=FALSE, points=FALSE,
                 showpar=FALSE, showresults=FALSE, digits=6, ...)

Arguments

n
Sample size $n$ per simulation;
nsim
Number of simulations to perform;
compositor
The compositing function that could be either composite1COP, composite2COP, and composite3COP
parents
A special parameter list (see Note);
ploton
A logical to toggle on intermediate plotting;
points
A logical to actually draw the simulations on the ploton by the points function in R;
showpar
Print the simulated parameter set with each iteration;
showresults
Print the results (useful if harvest results from a batch operation of R);
digits
The number digits to pass to round if showresults is true; and
...
Additional arguments to pass.

Value

  • A matrix of results is returned. Each row represents a single simulation run. The first four columns are the $\alpha$, $\beta$, $\kappa$, and $\gamma$ compositing parameters and are labeled as such. The next two columns are the opposing diagonals, by first row and then second, of the L-comoment correlation. The following two columns are the opposing diagnonals, by row and then second, of the L-coskew. The following two columns are the opposing diagnonals, by row and then second, of the L-cokurtosis. The L-comoment columns are labeled to reflect the L-comoment matrix: T2.21 means the L-comoment correlation row 2 column 1 and T3.12 mean the L-coskew row 1 column 2. The remaining columns represent the $\Theta_n$ parameters for copula 1, the $\Theta_m$ parameters for copula 2. The columns are labeled Cop1Thetas or Cop2Thetas.

See Also

simcompositeCOP, simCOP

Examples

Run this code
# EXAMPLE 1: Make a single simulation "result" for a sample of size 200.
mainpara <- list(cop1=PLACKETTcop, cop2=PLACKETTcop,
                 para1gen=function() { return(c(10^runif(1,min=-5,max=0))) },
                 para2gen=function() { return(c(10^runif(1,min= 0,max=5))) })
v <- simcompositeCOP(n=200, nsim=1, parent=mainpara, showresults=TRUE)
print(v)

# EXAMPLE 2: Make a 10 "results" for a sample of size 200 and plot two columns.
mainpara <- list(cop1=PLACKETTcop, cop2=N4212cop,
                 para1gen=function() { return(c(10^runif(1,min=-5,max=5))) },
                 para2gen=function() { return(c(10^runif(1,min= 0,max=2))) })
v <- simcomposite3COP(n=500, nsim=10, parent=mainpara); labs <- colnames(v)
plot(v[,5],v[,7], # open circles are 1 with respect to 2
     xlab=paste(c(labs[5], "and", labs[6]), collapse=" "),
     ylab=paste(c(labs[6], "and", labs[8]), collapse=" "))
points(v[,6],v[,8], pch=16) # black dots are 2 with respect to 1

Run the code above in your browser using DataLab