Skip to content
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

problem with Copula Frank samples #64

Closed
Santymax98 opened this issue Nov 15, 2023 · 5 comments · Fixed by #65
Closed

problem with Copula Frank samples #64

Santymax98 opened this issue Nov 15, 2023 · 5 comments · Fixed by #65

Comments

@Santymax98
Copy link
Contributor

Hi, I had a very strange problem, when I want to sample the two-dimensional Frank copula I get infinite values.

F = FrankCopula(2,98.11)
r = rand(F,1)
Just with one value, it is giving infinity

I also tried with parameters like 86.44 and 75.

@Santymax98
Copy link
Contributor Author

I realized that if you use a parameter greater than or equal to 38 the samples start to come out infinite.

@lrnv
Copy link
Owner

lrnv commented Nov 15, 2023

There are overflow happening, this is a pitty. You may obtain the right answer by use bigfloats :

julia> BF = FrankCopula(2,big(100.0))
FrankCopula{2, BigFloat}=100.0)

julia> rand(BF)
2-element Vector{Float64}:
 0.9345996751765854
 0.9568914260322661

However, it looks like it might be possible to achieve the same kind of results with Float64 by leveraging the LogExpFunctions.logm1exp() function if we take enough care, I tried a few things in #65 without much success for the moment, but I do not give up. You may take a look if you want :)

@lrnv
Copy link
Owner

lrnv commented Nov 15, 2023

Another option (the one chosen by the R package) is to just give up and furnish MCopula samples instead for theta > 38 ( they also have a hardcoded 38 there, you did find the right value). But I am not sure I am willing to do that without at least a warning..

@Santymax98
Copy link
Contributor Author

I am working with dynamic copulas, that is, the parameter can change over time and in the simulations it gives some parameters a little greater than 30, I think that for now I will use the BigFloat option, it is strange that for very small negative values, for example -120 he gives samples without problems

@lrnv
Copy link
Owner

lrnv commented Nov 15, 2023

Did you took a look at those samples ? They might not be very good ones. In #65 I am actually adding a test on uniformity of marginals to check for these kind of stuff more seriously in the future.

@lrnv lrnv closed this as completed in #65 Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants