-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Frank copula #16
Add Frank copula #16
Conversation
According to Dependence modeling with copulas (Harry Joe) the extension to negative dependence is not supported in all of [0,1]^d and therefore not useful for statistical modeling. Also adds tests for groundedness, uniform margins and 2-increasingness.
This looks great. Nice trick using When One small comment is that the grid search test for 2-increasing could be slightly denser than |
I'll finish this in October once I'm done with the thesis 🤞 . A heads up though: There seems to be an issue with the frank copula in the |
For negative dependence the generator of the Clayton copulas is not strict anymore. To adapt to this, we can set the cdf to 0 for I also added a few more tests for (inverse)generators in Clayton and Frank. |
This correctly returns 0.0 for the density of one of the inputs is zero and also fixes the issue with negative dependence for the clayton copula. The tests were refactored and updated. I extracted the tests that work for all copulas like grounded, 2-increasing etc..
@AnderGray I think this should be ready to merge now. One thing I was thinking: Currently the derivatives of the (inverse) generators are only used for the density. We could just implement a density function for each archimedean copula instead. Which I think would be cleaner and easier to test. Not sure if we will need to derivatives for anything else later on. Thoughts? |
Thanks for the PR! I like how you've implemented it with the generators. Seems general. To add a new copula, all you would need to is add a valid generator (and it's inverse). The rest could probably be derived automatically with AD. But yes, since we know the DFs for Clayton and Frank in closed form, it could be beneficial to just add these. It would also be good to test the generated cdf and pdf against the closed form equations. Merged as it is for now. |
This PR will add the Frank copula in line with the previously defined interface for archimedean copulas. It also fixes some issues there were with the Clayton copula. I changed the naming conventions for the derivatives to make them easier to read and write.
I removed the extension of the Clayton copula to negative parameters. According to Dependence modeling with copulas (Harry Joe) the extension to negative dependence is not supported in all of [0,1]^d and therefore not useful for statistical modeling. While sampling would work as is, the
cdf
anddensity
functions aren't well defined for negative dependence. Thoughts?Also adds tests for groundedness, uniform margins and 2-increasingness as well as a few tests for generator limits.
New dependencies are
GSL
for thedebye
function andRoots
. Since there is no closed form solution for the inverse rosenblatt for archimedean copulas other thanClayton
I am using root finding to invert the transformation. This can be quite slow for large sample sizes.