Processed covariance
PortfolioOptimisers.ProcessedCovariance Type
struct ProcessedCovariance{__T_ce, __T_alg, __T_pdm} <: AbstractCovarianceEstimatorA covariance estimator that applies a custom matrix processing algorithm and positive definite projection to the output of another covariance estimator. This type enables flexible post-processing of covariance matrices by first computing a base covariance, then applying a user-specified matrix processing algorithm and positive definiteness correction in sequence.
Fields
ce: Covariance estimator.alg: Matrix processing algorithm.pdm: Positive definite matrix estimator.
Constructors
ProcessedCovariance(;
ce::StatsBase.CovarianceEstimator = Covariance(),
alg::Option{<:AbstractMatrixProcessingAlgorithm} = nothing,
pdm::Option{<:Posdef} = Posdef(),
) -> ProcessedCovarianceKeywords correspond to the struct's fields.
Propagated parameters
When factory is called on this type, the following @fprop-tagged fields are automatically propagated:
ce: Recursively updated viafactory.
View parameters
When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:
ce: Recursively viewed viaport_opt_view.
Examples
julia> ProcessedCovariance()
ProcessedCovariance
ce ┼ Covariance
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ ce ┼ GeneralCovariance
│ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ w ┴ nothing
│ alg ┴ Full()
alg ┼ nothing
pdm ┼ Posdef
│ alg ┼ UnionAll: NearestCorrelationMatrix.Newton
│ kwargs ┴ @NamedTuple{}: NamedTuple()Related
sourcePortfolioOptimisers.factory Method
factory(
ce::StatsBase.CovarianceEstimator,
args...;
kwargs...
) -> StatsBase.CovarianceEstimatorFallback for covariance estimator factory methods.
Arguments
ce: Covariance estimator.args...: Optional arguments (ignored).kwargs...: Optional keyword arguments (ignored).
Returns
ce::StatsBase.CovarianceEstimator: The original covariance estimator.
Related
sourceStatistics.cov Method
Statistics.cov(ce::ProcessedCovariance, X::MatNum; dims = 1, kwargs...)Compute the processed and positive definite projected covariance matrix for the data matrix X using the specified ProcessedCovariance estimator.
Arguments
ce: TheProcessedCovarianceestimator specifying the base covariance estimator, matrix processing algorithm, and positive definite projection.X: The data matrix (observations × assets).dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the underlying covariance estimator and processing algorithm.
Returns
sigma::MatNum: processed covariance matrix.
Validation
dims in (1, 2).
Details
Computes the covariance matrix using the base estimator in
ce.Transposes
Xifdims == 2to ensure variables are in columns.Ensures the covariance matrix is mutable.
Applies positive definite projection using the method in
ce.pdm.Applies the matrix processing algorithm in
ce.algto the covariance matrix.Returns the processed covariance matrix.
Related
sourceStatistics.cor Method
Statistics.cor(ce::ProcessedCovariance, X::MatNum; dims = 1, kwargs...)Compute the processed and positive definite projected correlation matrix for the data matrix X using the specified ProcessedCovariance estimator.
Arguments
ce: TheProcessedCovarianceestimator specifying the base covariance estimator, matrix processing algorithm, and positive definite projection.X: The data matrix (observations × assets).dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the underlying correlation estimator and processing algorithm.
Returns
rho::MatNum: processed correlation matrix.
Validation
dims in (1, 2).
Details
Computes the correlation matrix using the base estimator in
ce.Transposes
Xifdims == 2to ensure variables are in columns.Ensures the correlation matrix is mutable.
Applies positive definite projection using the method in
ce.pdm.Applies the matrix processing algorithm in
ce.algto the correlation matrix.Returns the processed correlation matrix.
Related
source