Processed covariance

PortfolioOptimisers.ProcessedCovarianceFunction
ProcessedCovariance(;
    ce::StatsBase.CovarianceEstimator = Covariance(),
    alg::Option{<:AbstractMatrixProcessingAlgorithm} = nothing,
    pdm::Option{<:AbstractPosdefEstimator} = Posdef(),
) -> PortfolioOptimisersCovariance

ProcessedCovariance(
    ce::StatsBase.CovarianceEstimator,
    alg::Option{<:AbstractMatrixProcessingAlgorithm},
    pdm::Option{<:AbstractPosdefEstimator},
) -> PortfolioOptimisersCovariance

Convenience constructor. Returns a PortfolioOptimisersCovariance configured to apply positive definite projection then a custom matrix processing algorithm, in that order, via MatrixProcessing.

matrix_processing! in src/04_MatrixProcessing/04_MatrixProcessing.jl states what an AbstractMatrixProcessingAlgorithm does to the matrix, and posdef! in src/04_MatrixProcessing/01_PosdefMatrix.jl states the mathematics of the projection.

Algorithm

  1. Build a MatrixProcessing from pdm and alg, with order = (:pdm, :alg).
  2. Return a PortfolioOptimisersCovariance carrying ce and that estimator.

order is what fixes the composition: Statistics.cov runs ce first, then projects the matrix onto the positive definite cone, and applies alg last. A caller who needs the reverse order builds the MatrixProcessing itself.

Arguments

  • ce: Covariance estimator.
  • alg: Optional matrix processing algorithm applied after the projection. If nothing, the projection is the only step.
  • pdm: Optional positive definite matrix estimator.

Returns

  • ce::PortfolioOptimisersCovariance: Composite estimator that applies alg to the matrix ce computes.

Examples

julia> ProcessedCovariance()PortfolioOptimisersCovariance  ce ┼ Covariance     │    me ┼ SimpleExpectedReturns     │       │   w ┴ nothing     │    ce ┼ GeneralCovariance     │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)     │       │    w ┴ nothing     │   alg ┼ FullMoment()     │     w ┴ nothing  mp ┼ MatrixProcessing     │     pdm ┼ Posdef     │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton     │         │   kwargs ┴ @NamedTuple{}: NamedTuple()     │      dn ┼ nothing     │      dt ┼ nothing     │     alg ┼ nothing     │   order ┴ Tuple{Symbol, Symbol}: (:pdm, :alg)

Related

source