Learn R Programming

GRIDCOPULA (version 1.0.1)

estimate.gridCopula: Estimates the parameters of a grid type copula

Description

This function estimates grid type copulas by one of the following methods: maximum likelihood or least squares (See reference).

Usage

estimate.gridCopula(
  X = NULL,
  U = NULL,
  k = NULL,
  m = NULL,
  method = "ml",
  D.ini = NULL,
  criterion = "AIC"
)

Value

Returns a list with a matrix with the density over the grid, a matrix with the quantity of data over the grid, the number of subintervals for the \(U_2\) variable, the number of subintervals for the \(U_1\) variable, a matrix with the values of \(u_1\) and \(u_2\) in the copula domain and a matrix with the original values X.

Arguments

X

a matrix of size \(nx2\) with the observed values in any domain, optional if \(U\) is provided.

U

a matrix of size \(nx2\) with the observed values in the copula domain, optional if \(X\) is provided.

k

a positive integer indicating the number of subintervals for the \(U_2\) variable.

m

a positive integer indicating the number of subintervals for the \(U_1\) variable.

method

the selected method for estimation, can be least squares "ls" or maximum likelihood "ml". By default "ml".

D.ini

an optional matrix with initial density values for the estimation through maximum likelihood.

criterion

If the values of k and m are not specified, they will be obtained by the "AIC" or "BIC" criteria, by default "AIC".

References

Pfeifer, D., Strassburger, D., & Philipps, J. (2020). Modelling and simulation of dependence structures in nonlife insurance with Bernstein copulas. arXiv. Retrieved from https://arxiv.org/abs/2010.15709

Examples

Run this code
# Generating simulated data with a transformation to the copula domain
n <- 500
x <- rgamma(n,4,1/2)
e <- rnorm(n,0,.3)
y <- sin(x+e)
Fx <- ecdf(x)
Fy <- ecdf(y)
u <- Fx(x)
v <- Fy(y)
df <- cbind(u,v)
copula.grid <- estimate.gridCopula(U = df, k = 5, m = 4 , method = "ml")
print(copula.grid$Density)

# Using the Iris dataset, transformation is not mandatory
copula.grid <- estimate.gridCopula(X = iris[,1:2], k = 3, m = 7 , method = "ml")
print(copula.grid$Density)

Run the code above in your browser using DataLab