Windowed covariance: private API

Functions

PortfolioOptimisers.variance_series — Method
variance_series(
    ce::WindowedCovariance,
    X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}};
    dims,
    kwargs...
) -> Matrix

Compute the point-in-time variance series of a windowed covariance estimator.

Row t is the fit of the estimator on the observations 1 to t. The estimator keeps the last observations of its window among them, so the window rolls with t, and the last row equals the batch fit. Before the window is full, row t keeps every observation from 1 to t. variance_series(est, w::Option{<:ObsWeights}, window::Option{<:Int_VecInt}, X::MatNum, pnl::Option{<:AssetPanel}) states the rule.

A prior calls this method with the active_mask and estimation_mask keywords, and each fit cuts them to its own rows.

Arguments

  • ce: Windowed covariance estimator.
  • X: Data matrix observations × assets if the dims keyword does not exist or dims = 1, assets × observations when dims = 2.
  • dims: Dimension along which the computation runs.
  • kwargs...: Keywords passed to the inner estimator. The two universe masks are cut to the rows of each fit.

Validation

  • dims in (1, 2).

Returns

  • val::Matrix{<:Number}: Variance series, shaped as (T, N) if dims == 1 or (N, T) if dims == 2.

Related

source
PortfolioOptimisers.variance_series — Method
variance_series(
    ce::WindowedCovariance,
    X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Matrix

Compute the point-in-time variance series of a windowed covariance estimator from an Asset Panel.

Row t is the fit of the estimator on the observations 1 to t of the returns and of the panel, as in variance_series(ce::WindowedCovariance, X::MatNum; dims::Int = 1, kwargs...). Each fit gives the inner estimator the panel over its own rows, so a mask-aware inner estimator reads the active mask of the window, and a plain one reduces to the Coverage Universe of the window.

Arguments

  • ce: Windowed covariance estimator.
  • X: Data matrix observations × assets if the dims keyword does not exist or dims = 1, assets × observations when dims = 2.
  • pnl: Optional AssetPanel. The Coverage Universe of the fit comes from its active mask. If it is nothing, the rule reads only the finiteness of the returns.
  • dims: Dimension along which the computation runs.
  • kwargs...: Keywords passed to the inner estimator.

Validation

  • dims in (1, 2).

Returns

  • val::Matrix{<:Number}: Variance series, shaped as (T, N) if dims == 1 or (N, T) if dims == 2.

Related

source