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.cov — Method
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
- Reduce
Xto its Coverage Universe withcoverage_reduction. - Call the plain estimator on the clean block, with the caller's
dimsand keywords. - Expand the answer with
expand_moment.
Arguments
ce: Covariance estimator.me: Expected returns estimator.ske: Coskewness estimator.kte: Cokurtosis estimator.X: Data matrixobservations × assetsif thedimskeyword does not exist ordims = 1,assets × observationswhendims = 2.pnl: OptionalAssetPanel, whose active mask the Coverage Universe of the fit is derived from.nothingmakes 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
NaNoutside the Coverage Universe.
Related
Statistics.cor — Method
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
Statistics.var — Method
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
Statistics.std — Method
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
Statistics.mean — Method
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
PortfolioOptimisers.coskewness — Method
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
PortfolioOptimisers.cokurtosis — Method
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
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.
Statistics.mean — Method
mean(
me::SimpleExpectedReturns,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.mean for a SimpleExpectedReturns, which routes on its cvg field with coverage_panel_moment.
Related
Statistics.var — Method
var(
ve::SimpleVariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.var for a SimpleVariance, which routes on its cvg field with coverage_panel_moment.
Related
Statistics.std — Method
std(
ve::SimpleVariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.std for a SimpleVariance, which routes on its cvg field with coverage_panel_moment.
Related
Statistics.cov — Method
cov(
ce::Covariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.cov for a Covariance, which routes on its cvg field with coverage_panel_moment.
Related
Statistics.cor — Method
cor(
ce::Covariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.cor for a Covariance, which routes on its cvg field with coverage_panel_moment.
Related
Statistics.var — Method
var(
ce::Covariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.var for a Covariance, which routes on its cvg field with coverage_panel_moment. The answer is a marginal, so it frames along its asset axis alone.
Related
Statistics.std — Method
std(
ce::Covariance,
X::AbstractMatrix{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
kwargs...
) -> Any
Asset Panel method of Statistics.std for a Covariance, which routes on its cvg field with coverage_panel_moment. The answer is a marginal, so it frames along its asset axis alone.
Related