Windowed Cokurtosis
PortfolioOptimisers.WindowedCokurtosis Type
struct WindowedCokurtosis{__T_ke, __T_w, __T_window} <: CokurtosisEstimatorCokurtosis estimator that restricts computation to a rolling or indexed observation window.
WindowedCokurtosis wraps a Cokurtosis 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 cokurtosis estimation.
Fields
ke: Cokurtosis estimator.w: Optional observation weights vectorobservations × 1, or a concrete subtype ofDynamicAbstractWeights. Ifnothing, the computation is unweighted.window: Window specification: an integer (lastwindowobservations) or a vector of indices.
Constructors
WindowedCokurtosis(;
ke::Cokurtosis = Cokurtosis(),
w::Option{<:ObsWeights} = nothing,
window::Option{<:Int_VecInt} = nothing
) -> WindowedCokurtosisKeywords correspond to the struct's fields.
Validation
If
wis notnothing,!isempty(w).If
windowis provided, it must be nonempty, nonnegative, and finite.
Examples
julia> WindowedCokurtosis()
WindowedCokurtosis
ke ┼ Cokurtosis
│ 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 ┴ nothingRelated
sourcePortfolioOptimisers.factory Method
factory(ke::WindowedCokurtosis, w::ObsWeights) -> WindowedCokurtosisReturn a new WindowedCokurtosis estimator with observation weights w applied to the underlying cokurtosis estimator and stored as the windowed weights.
Arguments
ke: Windowed cokurtosis estimator.w: Observation weights vectorobservations × 1.
Returns
ke::WindowedCokurtosis: Updated estimator with weights applied.
Related
sourcePortfolioOptimisers.cokurtosis Method
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 ofImpliedVolatility.kwargs...: Additional keyword arguments passed to the underlying estimator.
Returns
ckurt::Matrix{<:Number}: Cokurtosis tensor (assets² × assets²).
Related
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(kte::WindowedCokurtosis, i, args...)Gets the view of the coskewness estimator for the i-th element(s).
Arguments
kte: Cokurtosis estimator.i: Index or indices to view.
Returns
kev: New cokurtosis estimator of the same type as the argument, for the new view.
Related
source