Coder Social home page Coder Social logo

Comments (9)

Santymax98 avatar Santymax98 commented on June 19, 2024 1

Understood, thank you very much for the suggestion and for answering the Issue.

from copulas.jl.

lrnv avatar lrnv commented on June 19, 2024

Indeed it is not. There is no default implementation, the archimedean copulas have their implementation but the elliptical ones have none.

Do you want to provide a default implementation ? As $\tau(C) = 4 * Expectation (C(U)) - 1$ for $U \sim C$ ? You may use Distributions.expectation() as is done at several other places in the package.

PS : For the gaussian and elliptical copula, there are some known formulas right ? Maybe implementing those would be better.

from copulas.jl.

Santymax98 avatar Santymax98 commented on June 19, 2024

Does it mean that I can't calculate Kendall's tau for an Archimedean copula either?

`julia> C = ClaytonCopula(2,1.5)
ClaytonCopula{2, Float64}(θ=1.5)

julia> τ(C)
ERROR: UndefVarError: τ not defined
Stacktrace:
[1] top-level scope
@ REPL[10]:1

julia> `

from copulas.jl.

lrnv avatar lrnv commented on June 19, 2024

The function exists but is not exported yet :

julia> using Copulas

julia> C = ClaytonCopula(2,10)
ClaytonCopula{2, Int64}(
G: Copulas.ClaytonGenerator{Int64}(10)
)


julia> Copulas.τ(C)
0.8333333333333334

julia> τ(C)
ERROR: UndefVarError: `τ` not defined
Stacktrace:
 [1] top-level scope
   @ REPL[8]:1

julia> 

Btw you might want to upgrade to 0.1.19 since we fixed a lot of bugs recently.

We could make this public API by exporting the function, but since it is not implemented for all copulas I am not sure it is a good idea yet. If we have an implementation for ALL copulas, then yes we might export it :)

from copulas.jl.

lrnv avatar lrnv commented on June 19, 2024

Btw in fact it already works for the gaussian :

julia> C = GaussianCopula([1 0.5; 0.5 1])
GaussianCopula{2, Matrix{Float64}}(
Σ: [1.0 0.5; 0.5 1.0]
)


julia> Copulas.τ(C)
0.16834795498215338

julia> 

from copulas.jl.

Santymax98 avatar Santymax98 commented on June 19, 2024

Now I got it, however, what copulas is it missing for? It would be good to implement it together with Sperman's Rho

from copulas.jl.

lrnv avatar lrnv commented on June 19, 2024

The implementation is there :

Copulas.jl/src/Copula.jl

Lines 24 to 35 in d7cf205

function ρ(C::Copula{d}) where d
F(x) = Distributions.cdf(C,x)
z = zeros(d)
i = ones(d)
r = Cubature.pcubature(F,z,i,reltop=sqrt(eps()))[1]
return 12*r-3
end
function τ(C::Copula)
F(x) = Distributions.cdf(C,x)
r = Distributions.expectation(F,C)
return 4*r-1
end

But it is not well tested for the moment. What we could do is add some tests.

from copulas.jl.

Santymax98 avatar Santymax98 commented on June 19, 2024

I understand, that function is general. At least for now it can be used. You could try the copula T, I think it is giving some Nan values

`julia> Copa=TCopula(4,Σ)
TCopula{2, 4, Matrix{Float64}}(
Σ: [1.0 0.8; 0.8 1.0]
)

julia> Copulas.τ(Copa)
NaN`

from copulas.jl.

lrnv avatar lrnv commented on June 19, 2024

Yes, and also spearman's rho does not work on this one too. THis is indeed something that should be fixed if we want to export these functions and make them public API.

from copulas.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.