The Coverage Universe

An asset is in the Coverage Universe of one fit when its return is finite and the active mask of the AssetPanel is true at every row of the window. A prior reduces its returns matrix to that universe, fits every plain estimator on the clean block, and expands every block of its result onto the full asset universe with a NaN frame outside it.

The Asset Panel travels as the third positional argument of every moment verb, and the root method of each verb is that reduce-and-expand. A mask-aware estimator overrides its root and takes the whole window.

The roots of the seven verbs

Statistics.covMethod
cov(
    ce::AbstractCovarianceEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Any

Fit a moment on the Coverage Universe of an Asset Panel, and expand it to the full asset universe.

This is the covariance root, and the six verbs beside it — cor, var, std, mean, coskewness and cokurtosis — each carry the same root and refer to this one for the rule.

The Asset Panel travels as the third positional argument of every moment verb, as it travels as the third positional argument of prior. This is the root method of each verb, and it is the reduce-and-expand: it reduces X to its Coverage Universe, hands the clean block to the plain estimator, and writes the answer back into a NaN frame of the full width.

A plain estimator needs no method of its own and no declaration. A mask-aware estimator overrides this method and reads pnl.amsk itself, because it alone knows its warm-up, its freezes and its resets, and it emits its own frame over the whole window.

The cost of the rule is coverage_mask's: one non-finite return, or one inactive row, inside the window puts the asset outside the Coverage Universe for that fit, and its entries of the answer are NaN.

Algorithm

  1. Reduce X to its Coverage Universe with coverage_reduction.
  2. Call the plain estimator on the clean block, with the caller's dims and keywords.
  3. Expand the answer with expand_moment.

Arguments

  • ce: Covariance estimator.
  • me: Expected returns estimator.
  • ske: Coskewness estimator.
  • kte: Cokurtosis estimator.
  • X: Data matrix observations × assets if the dims keyword does not exist or dims = 1, assets × observations when dims = 2.
  • pnl: Optional AssetPanel, whose active mask the Coverage Universe of the fit is derived from. nothing makes the rule finiteness alone.
  • dims: Dimension along which to perform the computation.
  • kwargs...: Additional keyword arguments passed to the estimator.

Validation

  • dims in (1, 2).
  • At least one asset must be in the Coverage Universe.

Returns

  • The moment on the full asset universe, carrying NaN outside the Coverage Universe.

Related

source
Statistics.corMethod
cor(
    ce::AbstractCovarianceEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
)

The correlation root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost.

Related

source
Statistics.varMethod
var(
    ce::AbstractCovarianceEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Any

The variance root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost. The answer is a marginal, so it expands along its asset axis alone.

Related

source
Statistics.stdMethod
std(
    ce::AbstractCovarianceEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Any

The standard deviation root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost. The answer is a marginal, so it expands along its asset axis alone.

Related

source
Statistics.meanMethod
mean(
    me::AbstractExpectedReturnsEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Any

The expected returns root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost. The answer is a marginal, so it expands along its asset axis alone.

Related

source
PortfolioOptimisers.coskewnessMethod
coskewness(
    ske::CoskewnessEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Tuple{Any, Any}

The coskewness root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost. The answer is a pair, so the tensor expands at the pair index and the negative spectral skewness matrix expands as a covariance-like matrix.

Related

source
PortfolioOptimisers.cokurtosisMethod
cokurtosis(
    kte::CokurtosisEstimator,
    X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
    pnl::Union{Nothing, AssetPanel};
    dims,
    kwargs...
) -> Any

The cokurtosis root of the Asset Panel seam. It is the reduce-and-expand of Statistics.cov(ce::AbstractCovarianceEstimator, X::MatNum, pnl::Option{<:AssetPanel}; dims::Int = 1, kwargs...), which states the rule and its cost. The answer is assets² × assets², so it expands at the pair index on both axes.

Related

source

The available-case seam

An estimator that carries a CoveragePolicy is a mask-aware estimator, so its panel method hands it the whole window and the panel's active mask instead of reducing to the Coverage Universe.