Skip to content
13

Cokurtosis

PortfolioOptimisers.Cokurtosis Type
julia
struct Cokurtosis{__T_me, __T_mp, __T_alg} <: CokurtosisEstimator

Container type for cokurtosis estimators.

Cokurtosis encapsulates the mean estimator, matrix processing estimator, and moment algorithm for cokurtosis estimation.

Fields

  • me: Expected returns estimator.

  • mp: Matrix processing estimator.

  • alg: Moment algorithm.

Constructors

julia
Cokurtosis(;
    me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
    mp::AbstractMatrixProcessingEstimator = DenoiseDetoneAlgMatrixProcessing(),
    alg::AbstractMomentAlgorithm = Full()
) -> Cokurtosis

Keywords correspond to the struct's fields.

Examples

julia
julia> Cokurtosis()
Cokurtosis
   me ┼ SimpleExpectedReturns
      │   w ┴ nothing
   mp ┼ DenoiseDetoneAlgMatrixProcessing
      │     pdm ┼ Posdef
      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │      dn ┼ nothing
      │      dt ┼ nothing
      │     alg ┼ nothing
      │   order ┴ DenoiseDetoneAlg()
  alg ┴ Full()

Related

source
PortfolioOptimisers.cokurtosis Function
julia
cokurtosis(ke::Option{<:Cokurtosis}, X::MatNum; dims::Int = 1,
           mean = nothing, kwargs...)

Compute the cokurtosis tensor for a dataset.

This method computes the cokurtosis tensor using the estimator's mean and matrix processing algorithm. For Full, it uses all centered data; for Semi, it uses only negative deviations. If the estimator is nothing, returns nothing.

Arguments

  • ke: Cokurtosis estimator.

    • ke::Cokurtosis{<:Any, <:Any, <:Full}: Cokurtosis estimator with Full moment algorithm.

    • ke::Cokurtosis{<:Any, <:Any, <:Semi}: Cokurtosis estimator with Semi moment algorithm.

    • ke::Nothing: No-op, returns nothing.

  • X: Data matrix (observations × assets).

  • dims: Dimension along which to perform the computation.

  • mean: Optional mean vector. If not provided, computed using the estimator's mean estimator.

  • kwargs...: Additional keyword arguments passed to the mean estimator.

Validation

  • dims is either 1 or 2.

Returns

  • ckurt::Matrix{<:Number}: Cokurtosis tensor (assets^2 × assets^2).

Examples

julia
julia> using StableRNGs

julia> rng = StableRNG(123456789);

julia> X = randn(rng, 10, 2);

julia> cokurtosis(Cokurtosis(), X)
4×4 Matrix{Float64}:
  1.33947   -0.246726  -0.246726   0.493008
 -0.246726   0.493008   0.493008  -0.201444
 -0.246726   0.493008   0.493008  -0.201444
  0.493008  -0.201444  -0.201444   0.300335

Related

source
julia
cokurtosis(ke::WindowedCokurtosis, X::MatNum; dims::Int = 1, iv::Option{<:MatNum} = nothing, kwargs...)

Compute the cokurtosis tensor using a rolling or indexed observation window.

This method selects a window of observations from X (and applies observation weights if specified), then delegates to the underlying cokurtosis estimator.

Arguments

  • ke: Windowed cokurtosis estimator.

  • X: Data matrix of asset returns (observations × assets).

  • dims: Dimension along which to perform the computation.

  • iv: Optional implied volatility matrix. Used if any internal covariance estimator is an instance of ImpliedVolatility.

  • kwargs...: Additional keyword arguments passed to the underlying estimator.

Returns

  • ckurt::Matrix{<:Number}: Cokurtosis tensor (assets² × assets²).

Related

source
PortfolioOptimisers.CokurtosisEstimator Type
julia
abstract type CokurtosisEstimator <: AbstractEstimator

Abstract supertype for all cokurtosis estimators in PortfolioOptimisers.jl.

All concrete and/or abstract types implementing cokurtosis estimation algorithms should be subtypes of CokurtosisEstimator.

Related

source
PortfolioOptimisers._cokurtosis Function
julia
_cokurtosis(X::MatNum, mp::AbstractMatrixProcessingEstimator)

Internal helper for cokurtosis computation.

_cokurtosis computes the cokurtosis tensor for the input data matrix and applies matrix processing using the specified estimator.

Arguments

  • X: Data matrix (observations × assets).

  • mp: Matrix processing estimator.

Returns

  • ckurt::Matrix{<:Number}: Cokurtosis tensor after matrix processing.

Related

source