Windowed expected returns
PortfolioOptimisers.WindowedExpectedReturns Type
struct WindowedExpectedReturns{__T_me, __T_w, __T_window} <: AbstractExpectedReturnsEstimatorExpected returns estimator that restricts computation to a rolling or indexed observation window.
WindowedExpectedReturns wraps another expected returns 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 expected returns estimation.
Fields
me: Expected returns 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
WindowedExpectedReturns(;
me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
w::Option{<:ObsWeights} = nothing,
window::Option{<:Int_VecInt} = nothing
) -> WindowedExpectedReturnsKeywords correspond to the struct's fields.
Validation
If
wis notnothing,!isempty(w).If
windowis provided, it must be nonempty, nonnegative, and finite.
Related
sourcePortfolioOptimisers.factory Method
factory(me::WindowedExpectedReturns, w::ObsWeights) -> WindowedExpectedReturnsReturn a new WindowedExpectedReturns estimator with observation weights w applied to the underlying mean estimator and stored as the windowed weights.
Arguments
me: Windowed expected returns estimator.w: Observation weights vectorobservations × 1.
Returns
me::WindowedExpectedReturns: Updated estimator with weights applied.
Related
sourceStatistics.mean Method
Statistics.mean(me::WindowedExpectedReturns, X::MatNum; dims::Int = 1, iv::Option{<:MatNum} = nothing, kwargs...)Compute expected returns 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 mean estimator.
Arguments
me: Windowed expected returns 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
mu::ArrNum: Expected returns vector for the selected window.
Related
source