0

I have 3 variables (temperature, consumption, price) and i want to fit a copula to the data. I used the package fitCopula. It works for normalCopula and tCopula but not for archimedean copulas (frank, clayton, gumbel)

fitCopula(frankCopula(dim=3), data = emp_data)
´´´

The error is: 

Error in fitCopula.ml(copula, u = data, method = method, start = start,  : 
  'start' contains NA values
Max
  • 3
  • 2
  • 1
    1. Have you tried looking over your data for 'NA's? 2. It is helpful to others to design your questions to have a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) 3. I find many R packages are best handled by finding the package forum, or getting in touch with the github;maintainer. ;) – mccurcio Apr 11 '23 at 18:15
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – mccurcio Apr 11 '23 at 18:15
  • 1
    thanks for your answers. I have no NAs. I tried the fitCopula function with method "itau". That works and i get the parameter -0.2. Now I want to create the copula with function claytonCopula. The problem is that I have negative correlated variables. When I have positive correlated variables the function works. The error is that you cant use negative parameters for 3 dimensional clayton copula. is there another way to do that? – Max Apr 12 '23 at 07:41
  • 1
    Could you please provide your data? I may help with this if the complete code is provided. – Dr. Alenezi Apr 14 '23 at 11:35

2 Answers2

1
  1. Consider transforming your data using a monotonic transformation, such as the inverse hyperbolic sine transformation, which can transform negative correlations into positive correlations.
  2. Once you have transformed your data, try fitting a Clayton copula or other methods.
  3. Use a different copula family that can handle negative dependence, such as the Gaussian copula or the Student's t copula.
mccurcio
  • 1,294
  • 5
  • 25
  • 44
1

Multivariate copula imposes the same dependency among all variables, which is not the case for most of the data. Moreover, for negative correlation you can use the rotation version of the Clayton.

For your case, and since you have three variables, you should use regular vine copula from the VineCopula package in R. You can use Rvinestructureselect() function to do everything for you; select the order of the variables, the best fit copula function for each two variables, and estimate the parameters.

L Tyrone
  • 1,268
  • 3
  • 15
  • 24
Alice
  • 111
  • 4
  • It is not true that multivariate copulas impose the same dependency among all variables. This is true for the "basic" copulas (Archimedean for example). The [nacopula package](https://rdrr.io/cran/copula/f/inst/doc/nacopula-pkg.pdf) provides *nested Archimedean copulas* that can capture more complex dependencies. – Stéphane Laurent May 20 '23 at 10:11
  • Interesting. But in multivariate case more than 3 variables, it loses its flexibility as the computations become more complicated. Am I correct? – Alice May 23 '23 at 03:13
  • 1
    >Alice: don't know, never tried :-) – Stéphane Laurent May 23 '23 at 07:52
  • 1
    @Alice. Yes, you are correct. Nested Archimedean copula becomes computationally more complex for more than three variables. – Dr. Alenezi Jun 07 '23 at 06:12