Processed covariance

PortfolioOptimisers.ProcessedCovariance — Function
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

Returns a PortfolioOptimisersCovariance that projects the covariance matrix to the positive definite cone and then applies a matrix processing algorithm of the caller. A MatrixProcessing applies the two steps in that order.

matrix_processing! in src/04_MatrixProcessing/04_MatrixProcessing.jl states what an AbstractMatrixProcessingAlgorithm does to the matrix. 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 that holds ce and that estimator.

The order field sets the composition. Statistics.cov runs ce first. Then it projects the matrix onto the positive definite cone, and it applies alg last. For the reverse order, build the MatrixProcessing directly.

Arguments

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

Returns

  • ce::PortfolioOptimisersCovariance: The composite estimator that applies alg to the matrix that 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