From 050a1f9ba21a4da7d5a0b3a059fc37190e0783c0 Mon Sep 17 00:00:00 2001 From: RRedding9 Date: Fri, 28 Nov 2025 15:18:52 +0000 Subject: [PATCH 1/3] Added LinearAlgebra prefix to Symmetric in TCopula Added LinearAlgebra prefix to Symmetric in TCopula. --- src/EllipticalCopulas/TCopula.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/EllipticalCopulas/TCopula.jl b/src/EllipticalCopulas/TCopula.jl index 2044db595..1ea27494d 100644 --- a/src/EllipticalCopulas/TCopula.jl +++ b/src/EllipticalCopulas/TCopula.jl @@ -58,7 +58,7 @@ function DistortionFromCop(C::TCopula{D,ν,MT}, js::NTuple{p,Int}, uⱼₛ::NTup if length(Jv) == 1 r = RiJ[1]; μz = r * zJ[1]; σ0² = 1 - r^2; δ = zJ[1]^2 else - L = LinearAlgebra.cholesky(Symmetric(ΣJJ)) + L = LinearAlgebra.cholesky(LinearAlgebra.Symmetric(ΣJJ)) μz = dot(RiJ, (L' \ (L \ zJ))) σ0² = 1 - dot(RiJ, (L' \ (L \ RJi))) y = L \ zJ; δ = dot(y, y) @@ -71,7 +71,7 @@ function ConditionalCopula(C::TCopula{D,df,MT}, js, uⱼₛ) where {D,df,MT} if p == 1 Σcond = Σ[I, I] - Σ[I, J] * (Σ[J, I] / Σ[J, J]) else - L = LinearAlgebra.cholesky(Symmetric(Σ[J, J])) + L = LinearAlgebra.cholesky(LinearAlgebra.Symmetric(Σ[J, J])) Σcond = Σ[I, I] - Σ[I, J] * (L' \ (L \ Σ[J, I])) end σ = sqrt.(LinearAlgebra.diag(Σcond)) @@ -97,4 +97,5 @@ function _rebound_params(::Type{<:TCopula}, d::Int, α::AbstractVector{T}) where return (; ν = ν, Σ = Σ) end -_available_fitting_methods(::Type{<:TCopula}, d) = (:mle,) \ No newline at end of file + +_available_fitting_methods(::Type{<:TCopula}, d) = (:mle,) From f6d534d04d7e08933c8758850d9144dee057bda7 Mon Sep 17 00:00:00 2001 From: RRedding9 Date: Fri, 28 Nov 2025 21:51:25 +0000 Subject: [PATCH 2/3] Added LinearAlgebra prefix to dot in TCopula --- src/EllipticalCopulas/TCopula.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/EllipticalCopulas/TCopula.jl b/src/EllipticalCopulas/TCopula.jl index 1ea27494d..fbe1ad098 100644 --- a/src/EllipticalCopulas/TCopula.jl +++ b/src/EllipticalCopulas/TCopula.jl @@ -59,9 +59,9 @@ function DistortionFromCop(C::TCopula{D,ν,MT}, js::NTuple{p,Int}, uⱼₛ::NTup r = RiJ[1]; μz = r * zJ[1]; σ0² = 1 - r^2; δ = zJ[1]^2 else L = LinearAlgebra.cholesky(LinearAlgebra.Symmetric(ΣJJ)) - μz = dot(RiJ, (L' \ (L \ zJ))) - σ0² = 1 - dot(RiJ, (L' \ (L \ RJi))) - y = L \ zJ; δ = dot(y, y) + μz = LinearAlgebra.dot(RiJ, (L' \ (L \ zJ))) + σ0² = 1 - LinearAlgebra.dot(RiJ, (L' \ (L \ RJi))) + y = L \ zJ; δ = LinearAlgebra.dot(y, y) end νp = ν + length(Jv); σz = sqrt(max(σ0², zero(σ0²))) * sqrt((ν + δ) / νp) return StudentDistortion(float(μz), float(σz), Int(ν), Int(νp)) @@ -99,3 +99,4 @@ end _available_fitting_methods(::Type{<:TCopula}, d) = (:mle,) + From 3494b6c2310527e51c626677e86869221ecd5414 Mon Sep 17 00:00:00 2001 From: RRedding9 Date: Fri, 28 Nov 2025 22:19:55 +0000 Subject: [PATCH 3/3] Refactor TCopula structure and documentation Fixed p == 1 ConditionalCopula case for TCopula --- src/EllipticalCopulas/TCopula.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EllipticalCopulas/TCopula.jl b/src/EllipticalCopulas/TCopula.jl index fbe1ad098..3b378f9bb 100644 --- a/src/EllipticalCopulas/TCopula.jl +++ b/src/EllipticalCopulas/TCopula.jl @@ -69,7 +69,7 @@ end function ConditionalCopula(C::TCopula{D,df,MT}, js, uⱼₛ) where {D,df,MT} p = length(js); J = collect(Int, js); I = collect(setdiff(1:D, J)); Σ = C.Σ if p == 1 - Σcond = Σ[I, I] - Σ[I, J] * (Σ[J, I] / Σ[J, J]) + Σcond = Σ[I, I] - Σ[I, J] * (Σ[J, J] \ Σ[J, I]) else L = LinearAlgebra.cholesky(LinearAlgebra.Symmetric(Σ[J, J])) Σcond = Σ[I, I] - Σ[I, J] * (L' \ (L \ Σ[J, I])) @@ -100,3 +100,4 @@ end _available_fitting_methods(::Type{<:TCopula}, d) = (:mle,) +