Mutual Information Covariance
PortfolioOptimisers.MutualInfoCovariance Type
struct MutualInfoCovariance{__T_ve, __T_bins, __T_normalise} <: AbstractCovarianceEstimatorCovariance 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
Where:
: Mutual information-based correlation between assets and . : Covariance between assets and . : (Optionally normalised) mutual information between assets and . : Marginal standard deviation of asset 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
MutualInfoCovariance(;
ve::AbstractVarianceEstimator = SimpleVariance(),
bins::Int_Bin = HacineGharbiRavier(),
normalise::Bool = true
) -> MutualInfoCovarianceKeywords correspond to the struct's fields.
Validation
- If
binsis an integer,bins > 0.
Examples
julia> MutualInfoCovariance()
MutualInfoCovariance
ve ┼ SimpleVariance
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ w ┼ nothing
│ corrected ┴ Bool: true
bins ┼ HacineGharbiRavier()
normalise ┴ Bool: trueRelated
sourcePortfolioOptimisers.factory Method
factory(ce::MutualInfoCovariance, w::ObsWeights) -> MutualInfoCovarianceReturn a new MutualInfoCovariance estimator with observation weights w applied to the underlying variance estimator.
Arguments
ce: Covariance estimator.w: Observation weights vectorobservations × 1.
Returns
ce: New covariance estimator of the same type as the argument, with the new weights applied.
Examples
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: trueRelated
sourceStatistics.cov Method
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
dimsis either1or2.
Related
sourceStatistics.cor Method
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
dimsis either1or2.
Related
sourcePortfolioOptimisers.port_opt_view Method
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