Skip to content
13

Windowed Coskewness

PortfolioOptimisers.WindowedCoskewness Type
julia
struct WindowedCoskewness{__T_ske, __T_w, __T_window} <: CoskewnessEstimator

Coskewness estimator that restricts computation to a rolling or indexed observation window.

WindowedCoskewness wraps another coskewness estimator and applies it to a subset of observations defined by a window and/or custom observation weights. This enables time-varying or recency-weighted coskewness estimation.

Fields

  • ske: Coskewness estimator.

  • w: Optional observation weights vector observations × 1, or a concrete subtype of DynamicAbstractWeights. If nothing, the computation is unweighted.

  • window: Window specification: an integer (last window observations) or a vector of indices.

Constructors

julia
WindowedCoskewness(;
    ske::CoskewnessEstimator = Coskewness(),
    w::Option{<:ObsWeights} = nothing,
    window::Option{<:Int_VecInt} = nothing
) -> WindowedCoskewness

Keywords correspond to the struct's fields.

Validation

  • If w is not nothing, !isempty(w).

  • If window is provided, it must be nonempty, nonnegative, and finite.

Examples

julia
julia> WindowedCoskewness()
WindowedCoskewness
     ske ┼ Coskewness
         │    me ┼ SimpleExpectedReturns
         │       │   w ┴ nothing
         │    mp ┼ MatrixProcessing
         │       │     pdm ┼ Posdef
         │       │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
         │       │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
         │       │      dn ┼ nothing
         │       │      dt ┼ nothing
         │       │     alg ┼ nothing
         │       │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)
         │   alg ┼ Full()
         │     w ┴ nothing
       w ┼ nothing
  window ┴ nothing

Related

source
PortfolioOptimisers.factory Method
julia
factory(ske::WindowedCoskewness, w::ObsWeights) -> WindowedCoskewness

Return a new WindowedCoskewness estimator with observation weights w applied to the underlying coskewness estimator and stored as the windowed weights.

Arguments

  • ske: Windowed coskewness estimator.

  • w: Observation weights vector observations × 1.

Returns

  • ske::WindowedCoskewness: Updated estimator with weights applied.

Related

source
PortfolioOptimisers.coskewness Method
julia
coskewness(ske::WindowedCoskewness, X::MatNum; dims::Int = 1, iv::Option{<:MatNum} = nothing, kwargs...)

Compute the coskewness tensor and processed matrix 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 coskewness estimator.

Arguments

  • ske: Windowed coskewness 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

  • cskew::Matrix{<:Number}: Coskewness tensor (assets × assets²).

  • V::Matrix{<:Number}: Processed coskewness matrix (assets × assets).

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    ske::WindowedCoskewness,
    i,
    args...
) -> WindowedCoskewness{<:CoskewnessEstimator}

Gets the view of the coskewness estimator for the i-th element(s).

Arguments

  • ske: Coskewness estimator.

  • i: Index or indices to view.

Returns

  • skev: New coskewness estimator of the same type as the argument, for the new view.

Related

source