Correlation covariance

PortfolioOptimisers.CorrelationCovarianceType
struct CorrelationCovariance{__T_ce} <: AbstractCovarianceEstimator

Answers both cov and cor with the wrapped estimator's correlation matrix.

Use it where a caller demands a covariance estimator but the computation wants the correlation — a clustering distance, for instance, which reads a scale-free matrix.

Fields

  • ce: Covariance estimator.

Constructors

CorrelationCovariance(;    ce::StatsBase.CovarianceEstimator = Covariance()) -> CorrelationCovariance

Keywords 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 via factory.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Examples

julia> CorrelationCovariance()CorrelationCovariance  ce ┼ Covariance     │    me ┼ SimpleExpectedReturns     │       │   w ┴ nothing     │    ce ┼ GeneralCovariance     │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)     │       │    w ┴ nothing     │   alg ┴ FullMoment()

Related

source
Statistics.covMethod
Statistics.cov(ce::CorrelationCovariance, X::MatNum; dims::Int = 1,
               kwargs...)

Compute the correlation matrix using the underlying estimator.

This method delegates to Statistics.cor(ce.ce, X; dims = dims, kwargs...), returning the correlation matrix as the "covariance". This is useful when a correlation matrix is required in a context that accepts a covariance estimator.

Arguments

  • ce: Correlation covariance estimator.
  • X: Data matrix of asset returns (observations × assets).
  • dims: Dimension along which to perform the computation.
  • kwargs...: Additional keyword arguments passed to the underlying estimator.

Returns

  • rho::MatNum: Correlation matrix assets x assets.

Related

source
Statistics.corMethod
Statistics.cor(ce::CorrelationCovariance, X::MatNum; dims::Int = 1,
               kwargs...)

Compute the correlation matrix using the underlying estimator.

This method delegates to Statistics.cor(ce.ce, X; dims = dims, kwargs...).

Arguments

  • ce: Correlation covariance estimator.
  • X: Data matrix of asset returns (observations × assets).
  • dims: Dimension along which to perform the computation.
  • kwargs...: Additional keyword arguments passed to the underlying estimator.

Returns

  • rho::MatNum: Correlation matrix assets x assets.

Related

source