Skip to content
13

Mutual Information Covariance

PortfolioOptimisers.MutualInfoCovariance Type
julia
struct MutualInfoCovariance{__T_ve, __T_bins, __T_normalise} <: AbstractCovarianceEstimator

Covariance estimator based on mutual information.

MutualInfoCovariance implements a robust covariance estimator that uses mutual information (MI) to capture both linear and nonlinear dependencies between asset returns. This estimator is particularly useful for identifying complex relationships that are not detected by traditional correlation-based methods. The MI matrix is optionally normalised and then rescaled by marginal standard deviations to produce a covariance matrix.

Mathematical definition

ρ^ij=MI(Xi,Xj),Σ^ij=ρ^ijσ^iσ^j.

Where:

  • ρ^ij: Mutual information-based correlation between assets i and j.

  • Σ^ij: Covariance between assets i and j.

  • MI(Xi,Xj): (Optionally normalised) mutual information between assets i and j.

  • σ^i: Marginal standard deviation of asset i from the variance estimator ve.

Fields

  • ve: Variance estimator.

  • bins: Binning algorithm or fixed number of bins.

  • normalise: Whether to normalise the mutual and/or variation of information calculation.

Constructors

julia
MutualInfoCovariance(;
    ve::AbstractVarianceEstimator = SimpleVariance(),
    bins::Int_Bin = HacineGharbiRavier(),
    normalise::Bool = true
) -> MutualInfoCovariance

Keywords correspond to the struct's fields.

Validation

  • If bins is an integer, bins > 0.

Examples

julia
julia> MutualInfoCovariance()
MutualInfoCovariance
         ve ┼ SimpleVariance
            │          me ┼ SimpleExpectedReturns
            │             │   w ┴ nothing
            │           w ┼ nothing
            │   corrected ┴ Bool: true
       bins ┼ HacineGharbiRavier()
  normalise ┴ Bool: true

Related

source
PortfolioOptimisers.factory Method
julia
factory(ce::MutualInfoCovariance, w::ObsWeights) -> MutualInfoCovariance

Return a new MutualInfoCovariance estimator with observation weights w applied to the underlying variance estimator.

Arguments

  • ce: Covariance estimator.

  • w: Observation weights vector observations × 1.

Returns

  • ce: New covariance estimator of the same type as the argument, with the new weights applied.

Examples

julia
julia> ce = MutualInfoCovariance();

julia> factory(ce, StatsBase.Weights([0.2, 0.3, 0.5]))
MutualInfoCovariance
         ve ┼ SimpleVariance
            │          me ┼ SimpleExpectedReturns
            │             │   w ┴ StatsBase.Weights{Float64, Float64, Vector{Float64}}: [0.2, 0.3, 0.5]
            │           w ┼ StatsBase.Weights{Float64, Float64, Vector{Float64}}: [0.2, 0.3, 0.5]
            │   corrected ┴ Bool: true
       bins ┼ HacineGharbiRavier()
  normalise ┴ Bool: true

Related

source
Statistics.cov Method
julia
Statistics.cov(ce::MutualInfoCovariance, X::MatNum; dims::Int = 1, kwargs...)

Compute the mutual information (MI) covariance matrix using a MutualInfoCovariance estimator.

This method computes the pairwise mutual information covariance matrix for the input data matrix X, using the binning strategy and normalisation specified in ce. The MI covariance matrix is obtained by rescaling the MI correlation matrix by the marginal standard deviations, as estimated by the variance estimator in ce.

Arguments

  • ce: Mutual information-based 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 variance estimator.

Returns

  • sigma::Matrix{<:Number}: Symmetric matrix of mutual information-based covariances.

Validation

  • dims is either 1 or 2.

Related

source
Statistics.cor Method
julia
Statistics.cor(ce::MutualInfoCovariance, X::MatNum; dims::Int = 1, kwargs...)

Compute the mutual information (MI) correlation matrix using a MutualInfoCovariance estimator.

This method computes the pairwise mutual information correlation matrix for the input data matrix X, using the binning strategy and normalisation specified in ce. The MI correlation captures both linear and nonlinear dependencies between asset returns, making it robust to complex relationships that may not be detected by traditional correlation measures.

Arguments

  • ce: Mutual information-based covariance estimator.

  • X: Data matrix of asset returns (observations × assets).

  • dims: Dimension along which to perform the computation.

  • kwargs...: Additional keyword arguments (currently unused).

Returns

  • rho::Matrix{<:Number}: Symmetric matrix of mutual information-based correlation coefficients.

Validation

  • dims is either 1 or 2.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    ce::MutualInfoCovariance,
    i,
    args...
) -> Union{MutualInfoCovariance{<:AbstractVarianceEstimator, <:Integer, Bool}, MutualInfoCovariance{<:AbstractVarianceEstimator, <:AbstractBins, Bool}}

Gets the view of the covariance estimator for the i-th element(s).

Arguments

  • ce: Covariance estimator.

  • i: Index or indices to view.

Returns

  • ce: New covariance estimator of the same type as the argument, for the new view.

Related

source