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 keeps only those assets of its returns matrix and fits each estimator on the smaller matrix. It then puts every result back on the full set of assets, with NaN for each asset outside the coverage universe.
Each of the seven moment functions takes the asset panel as its third positional argument. The default method of each function removes the assets outside the coverage universe and puts them back as NaN. An estimator that reads the masks itself has its own method, and receives the whole window.
The default methods of the seven moment functions
Statistics.cov — Method
cov(
ce::AbstractCovarianceEstimator,
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
Fit a moment on the Coverage Universe of an Asset Panel, and expand it to the full asset universe.
This is the root method of cov. The six other verbs, cor, var, std, mean, coskewness and cokurtosis, have root methods of the same shape, and their docstrings refer to this one for the rule.
The Asset Panel is the third positional argument of every moment verb, as it is of prior. The root method of each verb is the reduce-and-expand. It reduces X to its Coverage Universe, gives the clean block to the plain estimator, and writes the result 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 its warm-up, its freezes and its resets depend on the mask. It writes its own frame over the whole window.
The rule has the cost that coverage_mask states. One non-finite return, or one inactive row, in the window puts the asset outside the Coverage Universe of that fit, and its entries of the result are NaN.
A matrix call of a prior gives the active mask as the active_mask keyword, with no panel. The method reads that mask as it reads the mask of a panel, so the two calls reach one Coverage Universe.
Algorithm
- Reduce
Xto its Coverage Universe withcoverage_keyword_reduction, which readsactive_maskin the place of the active mask ofpnlwhen the caller gives one. The per-asset keywordsivandivpatake the same slice, and a gap inivnarrows the Coverage Universe when the estimator tree reads the surface, seereads_implied_volatility. - Call the plain estimator on the clean block, with the caller's
dimsand the reduced keywords. Every column of the block is active at every row, so the method does not passactive_maskon. - Expand the result 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. The Coverage Universe of the fit comes from its active mask. If it isnothing, the rule reads only the finiteness of the returns.dims: Dimension along which the computation runs.active_mask: The active mask ofX, of the shape ofX, ornothing. When it is notnothing, it takes the place of the active mask ofpnl.kwargs...: Additional keyword arguments passed to the estimator.
Validation
dims in (1, 2).- At least one asset must be in the Coverage Universe.
- When an asset is outside the Coverage Universe, the element type of the moment holds
NaN. AnIntegeror aRationalelement type raises anArgumentError.
Returns
- The moment on the full asset universe, carrying
NaNoutside the Coverage Universe.
Related
Statistics.cor — Method
cor(
ce::AbstractCovarianceEstimator,
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> AbstractMatrix{<:Union{Number, AbstractJuMPScalar}}
The correlation root of the Asset Panel methods of the moment verbs. 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{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
The variance root of the Asset Panel methods of the moment verbs. 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 result is a marginal, so it expands along its asset axis alone.
Related
Statistics.std — Method
std(
ce::AbstractCovarianceEstimator,
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
The standard deviation root of the Asset Panel methods of the moment verbs. 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 result is a marginal, so it expands along its asset axis alone.
Related
Statistics.mean — Method
mean(
me::AbstractExpectedReturnsEstimator,
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
The expected returns root of the Asset Panel methods of the moment verbs. 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 result is a marginal, so it expands along its asset axis alone.
Related
PortfolioOptimisers.coskewness — Method
coskewness(
ske::CoskewnessEstimator,
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
The coskewness root of the Asset Panel methods of the moment verbs. 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 result 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{Number, AbstractJuMPScalar}},
pnl::Union{Nothing, AssetPanel};
dims,
active_mask,
kwargs...
) -> Any
The cokurtosis root of the Asset Panel methods of the moment verbs. 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 result is assets² × assets², so it expands at the pair index on both axes.
Related
Estimators that fit each asset on its own observations
An estimator that carries a CoveragePolicy reads the masks itself. Its method with a panel passes it the whole window and the active mask of the panel, and does not remove the assets outside the coverage universe.
Statistics.mean — Method
mean(
me::SimpleExpectedReturns,
X::AbstractMatrix{<:Union{Number, 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{Number, 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{Number, 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{Number, 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{Number, 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{Number, 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 result is a marginal, so it frames along its asset axis alone.
Related
Statistics.std — Method
std(
ce::Covariance,
X::AbstractMatrix{<:Union{Number, 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 result is a marginal, so it frames along its asset axis alone.
Related