Smyth-Broby Covariance
PortfolioOptimisers.SmythBroby0 Type
struct SmythBroby0 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the original Smyth-Broby covariance algorithm (unstandardised variant).
Related
sourcePortfolioOptimisers.SmythBroby1 Type
struct SmythBroby1 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the first variant of the Smyth-Broby covariance algorithm (unstandardised).
Related
sourcePortfolioOptimisers.SmythBroby2 Type
struct SmythBroby2 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the second variant of the Smyth-Broby covariance algorithm (unstandardised).
Related
sourcePortfolioOptimisers.SmythBrobyGerber0 Type
struct SmythBrobyGerber0 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the original Gerber-style variant of the Smyth-Broby covariance algorithm (unstandardised).
Related
sourcePortfolioOptimisers.SmythBrobyGerber1 Type
struct SmythBrobyGerber1 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the first Gerber-style variant of the Smyth-Broby covariance algorithm (unstandardised).
Related
sourcePortfolioOptimisers.SmythBrobyGerber2 Type
struct SmythBrobyGerber2 <: UnstandardisedSmythBrobyCovarianceAlgorithm endImplements the second Gerber-style variant of the Smyth-Broby covariance algorithm (unstandardised).
Related
sourcePortfolioOptimisers.StandardisedSmythBroby0 Type
struct StandardisedSmythBroby0 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the original Smyth-Broby covariance algorithm on Z-transformed data (standardised variant).
Related
PortfolioOptimisers.StandardisedSmythBroby1 Type
struct StandardisedSmythBroby1 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the first variant of the Smyth-Broby covariance algorithm on Z-transformed data (standardised).
Related
PortfolioOptimisers.StandardisedSmythBroby2 Type
struct StandardisedSmythBroby2 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the second variant of the Smyth-Broby covariance algorithm on Z-transformed data (standardised).
Related
PortfolioOptimisers.StandardisedSmythBrobyGerber0 Type
struct StandardisedSmythBrobyGerber0 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the original Gerber-style variant of the Smyth-Broby covariance algorithm on Z-transformed data (standardised).
Related
PortfolioOptimisers.StandardisedSmythBrobyGerber1 Type
struct StandardisedSmythBrobyGerber1 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the first Gerber-style variant of the Smyth-Broby covariance algorithm on Z-transformed data (standardised).
Related
PortfolioOptimisers.StandardisedSmythBrobyGerber2 Type
struct StandardisedSmythBrobyGerber2 <: StandardisedSmythBrobyCovarianceAlgorithm endImplements the second Gerber-style variant of the Smyth-Broby covariance algorithm on Z-transformed data (standardised).
Related
PortfolioOptimisers.SmythBrobyCovariance Type
struct SmythBrobyCovariance{T1, T2, T3, T4, T5, T6, T7, T8, T9, T10} <:
BaseSmythBrobyCovariance
me::T1
ve::T2
pdm::T3
threshold::T4
c1::T5
c2::T6
c3::T7
n::T8
alg::T9
threads::T10
endA flexible container type for configuring and applying Smyth-Broby covariance estimators in PortfolioOptimisers.jl.
SmythBrobyCovariance encapsulates all components required for Smyth-Broby-based covariance or correlation estimation, including the expected returns estimator, variance estimator, positive definite matrix estimator, algorithm parameters, and the specific Smyth-Broby algorithm variant. This enables modular and extensible workflows for robust covariance estimation using Smyth-Broby statistics.
Fields
me: Expected returns estimator.ve: Variance estimator.pdm: Positive definite matrix estimator.threshold: Threshold parameter for Smyth-Broby covariance computation.c1: Zone of confusion parameter.c2: Zone of indecision lower bound.c3: Zone of indecision upper bound.n: Exponent parameter for the Smyth-Broby kernel.alg: Smyth-Broby covariance algorithm variant.threads: Parallel execution strategy.
Constructor
SmythBrobyCovariance(; me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
ve::StatsBase.CovarianceEstimator = SimpleVariance(),
pdm::Union{Nothing, <:Posdef} = Posdef(), threshold::Real = 0.5,
c1::Real = 0.5, c2::Real = 0.5, c3::Real = 4, n::Real = 2,
alg::SmythBrobyCovarianceAlgorithm = SmythBrobyGerber1(),
threads::FLoops.Transducers.Executor = ThreadedEx())Keyword arguments correspond to the fields above.
Validation
0 < threshold < 1.0 < c1 <= 1.0 < c2 <= 1.c3 > c2.
Examples
julia> SmythBrobyCovariance()
SmythBrobyCovariance
me ┼ SimpleExpectedReturns
│ w ┴ nothing
ve ┼ SimpleVariance
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ w ┼ nothing
│ corrected ┴ Bool: true
pdm ┼ Posdef
│ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
threshold ┼ Float64: 0.5
c1 ┼ Float64: 0.5
c2 ┼ Float64: 0.5
c3 ┼ Int64: 4
n ┼ Int64: 2
alg ┼ SmythBrobyGerber1()
threads ┴ Transducers.ThreadedEx{@NamedTuple{}}: Transducers.ThreadedEx()Related
Statistics.cov Method
cov(ce::SmythBrobyCovariance, X::AbstractMatrix; dims::Int = 1, mean = nothing, kwargs...)Compute the Smyth-Broby covariance matrix.
This method computes the Smyth-Broby covariance matrix for the input data matrix X. The mean and standard deviation vectors are computed using the estimator's expected returns and variance estimators. The Smyth-Broby covariance is then computed via smythbroby.
Arguments
ce: Smyth-Broby covariance estimator.ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:UnstandardisedSmythBrobyCovarianceAlgorithm, <:Any}: Compute the unstandardised Smyth-Broby covariance matrix.ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:StandardisedSmythBrobyCovarianceAlgorithm, <:Any}: Compute the standardised Smyth-Broby covariance matrix.
X: Data matrix (observations × assets).dims: Dimension along which to compute the covariance.mean: Optional mean vector for centering. If not provided, computed usingce.me.kwargs...: Additional keyword arguments passed to the mean and standard deviation estimators.
Returns
sigma::Matrix{<:Real}: The Smyth-Broby covariance matrix.
Validation
dimsis either1or2.
Related
sourceStatistics.cor Method
cor(ce::SmythBrobyCovariance, X::AbstractMatrix; dims::Int = 1, mean = nothing, kwargs...)Compute the Smyth-Broby correlation matrix.
This method computes the Smyth-Broby correlation matrix for the input data matrix X. The mean and standard deviation vectors are computed using the estimator's expected returns and variance estimators. The Smyth-Broby correlation is then computed via smythbroby.
Arguments
ce: Smyth-Broby covariance estimator.ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:UnstandardisedSmythBrobyCovarianceAlgorithm, <:Any}: Compute the unstandardised Smyth-Broby correlation matrix.ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:StandardisedSmythBrobyCovarianceAlgorithm, <:Any}: Compute the standardised Smyth-Broby correlation matrix.
X: Data matrix (observations × assets).dims: Dimension along which to compute the correlation.mean: Optional mean vector for centering. If not provided, computed usingce.me.kwargs...: Additional keyword arguments passed to the mean and standard deviation estimators.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix.
Validation
dimsis either1or2.
Related
sourcePortfolioOptimisers.BaseSmythBrobyCovariance Type
abstract type BaseSmythBrobyCovariance <: BaseGerberCovariance endAbstract supertype for all Smyth-Broby covariance estimators in PortfolioOptimisers.jl.
All concrete types implementing Smyth-Broby covariance estimation algorithms should subtype BaseSmythBrobyCovariance. This enables a consistent interface for Smyth-Broby-based covariance estimators throughout the package.
Related
sourcePortfolioOptimisers.SmythBrobyCovarianceAlgorithm Type
abstract type SmythBrobyCovarianceAlgorithm <: AbstractMomentAlgorithm endAbstract supertype for all Smyth-Broby covariance algorithm types in PortfolioOptimisers.jl.
All concrete types implementing specific Smyth-Broby covariance algorithms should subtype SmythBrobyCovarianceAlgorithm. This enables flexible extension and dispatch of Smyth-Broby covariance routines.
These types are used to specify the algorithm when constructing a SmythBrobyCovariance estimator.
Related
PortfolioOptimisers.UnstandardisedSmythBrobyCovarianceAlgorithm Type
abstract type UnstandardisedSmythBrobyCovarianceAlgorithm <: SmythBrobyCovarianceAlgorithm endAbstract supertype for all unstandardised Smyth-Broby covariance algorithm types.
Concrete types implementing unstandardised Smyth-Broby covariance algorithms should subtype UnstandardisedSmythBrobyCovarianceAlgorithm.
Related
PortfolioOptimisers.StandardisedSmythBrobyCovarianceAlgorithm Type
abstract type StandardisedSmythBrobyCovarianceAlgorithm <: SmythBrobyCovarianceAlgorithm endAbstract supertype for all standardised Smyth-Broby covariance algorithm types. These Z-transform the data before applying the Smyth-Broby covariance algorithm.
Concrete types implementing standardised Smyth-Broby covariance algorithms should subtype StandardisedSmythBrobyCovarianceAlgorithm.
Related
PortfolioOptimisers.sb_delta Function
sb_delta(xi::Real, xj::Real, mui::Real, muj::Real, sigmai::Real, sigmaj::Real, c1::Real,
c2::Real, c3::Real, n::Real)Smyth-Broby kernel function for covariance and correlation computation.
This function computes the kernel value for a pair of asset returns, applying the Smyth-Broby logic for zones of confusion and indecision. It is used to aggregate positive and negative co-movements in Smyth-Broby covariance algorithms.
Arguments
xi: Return for asseti.xj: Return for assetj.mui: Mean for asseti.muj: Mean for assetj.sigmai: Standard deviation for asseti.sigmaj: Standard deviation for assetj.c1: Zone of confusion parameter.c2: Zone of indecision lower bound.c3: Zone of indecision upper bound.n: Exponent parameter for the kernel.
Returns
score::Real: The computed score for the pair(xi, xj).
Details
If both returns are within the zone of confusion (
abs(xi) < sigmai * c1andabs(xj) < sigmaj * c1), returns zero.Computes centered and scaled returns
ri,rj.If both are within the zone of indecision (
ri < c2 && rj < c2) or both are above the upper bound (ri > c3 && rj > c3), returns zero.Otherwise, returns
sqrt((1 + ri) * (1 + rj)) / (1 + abs(ri - rj)^n).
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:SmythBroby0, <:Any}, X::AbstractMatrix,
mean_vec::AbstractArray, std_vec::AbstractArray)Implements the original Smyth-Broby covariance/correlation algorithm (unstandardised variant).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the original SmythBroby0 algorithm. The computation is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theSmythBroby0algorithm.X: Data matrix (observations × assets).mean_vec: Vector of means for each asset, used for centering.std_vec: Vector of standard deviations for each asset, used for scaling and thresholding.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, compute the centered and scaled returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel to accumulate positive (pos) and negative (neg) contributions.The correlation is computed as
(pos - neg) / (pos + neg)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBroby0, <:Any}, X::AbstractMatrix)Implements the original Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised variant).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the original StandardisedSmythBroby0 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBroby0algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos) and negative (neg) contributions.The correlation is computed as
(pos - neg) / (pos + neg)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBroby0, <:Any}, X::AbstractMatrix)Implements the original Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised variant).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the original StandardisedSmythBroby0 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBroby0algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos) and negative (neg) contributions.The correlation is computed as
(pos - neg) / (pos + neg)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBroby1, <:Any}, X::AbstractMatrix)Implements the first variant of the Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the StandardisedSmythBroby1 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive, negative, and neutral (non-exceedance) co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBroby1algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive, negative, and neutral co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos), negative (neg), and neutral (nn) contributions.The correlation is computed as
(pos - neg) / (pos + neg + nn)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:SmythBroby2, <:Any}, X::AbstractMatrix,
mean_vec::AbstractArray, std_vec::AbstractArray)Implements the second variant of the Smyth-Broby covariance/correlation algorithm (unstandardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the SmythBroby2 algorithm. The computation is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements. The resulting matrix is then standardised by the geometric mean of its diagonal elements.
Arguments
ce: Smyth-Broby covariance estimator configured with theSmythBroby2algorithm.X: Data matrix (observations × assets).mean_vec: Vector of means for each asset, used for centering.std_vec: Vector of standard deviations for each asset, used for scaling and thresholding.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, standardised and projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, compute the centered and scaled returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel to accumulate positive (pos) and negative (neg) contributions.The raw correlation is computed as
pos - neg.The resulting matrix is standardised by dividing each element by the geometric mean of the corresponding diagonal elements.
The matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBroby2, <:Any}, X::AbstractMatrix)Implements the second variant of the Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the StandardisedSmythBroby2 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements. The resulting matrix is then standardised by the geometric mean of its diagonal elements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBroby2algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, standardised and projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos) and negative (neg) contributions.The raw correlation is computed as
pos - neg.The resulting matrix is standardised by dividing each element by the geometric mean of the corresponding diagonal elements.
The matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:SmythBrobyGerber0, <:Any}, X::AbstractMatrix,
mean_vec::AbstractArray, std_vec::AbstractArray)Implements the original Gerber-style variant of the Smyth-Broby covariance/correlation algorithm (unstandardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the SmythBrobyGerber0 algorithm. The computation is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements, with additional weighting by the count of co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theSmythBrobyGerber0algorithm.X: Data matrix (observations × assets).mean_vec: Vector of means for each asset, used for centering.std_vec: Vector of standard deviations for each asset, used for scaling and thresholding.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, compute the centered and scaled returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel to accumulate positive (pos) and negative (neg) contributions, and count the number of positive (cpos) and negative (cneg) co-movements.The correlation is computed as
(pos * cpos - neg * cneg) / (pos * cpos + neg * cneg)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBrobyGerber0, <:Any},
X::AbstractMatrix)Implements the original Gerber-style variant of the Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the StandardisedSmythBrobyGerber0 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements, with additional weighting by the count of co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBrobyGerber0algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos) and negative (neg) contributions, and count the number of positive (cpos) and negative (cneg) co-movements.The correlation is computed as
(pos * cpos - neg * cneg) / (pos * cpos + neg * cneg)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:SmythBrobyGerber1, <:Any}, X::AbstractMatrix,
mean_vec::AbstractArray, std_vec::AbstractArray)Implements the first Gerber-style variant of the Smyth-Broby covariance/correlation algorithm (unstandardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the SmythBrobyGerber1 algorithm. The computation is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive, negative, and neutral co-movements, with additional weighting by the count of co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theSmythBrobyGerber1algorithm.X: Data matrix (observations × assets).mean_vec: Vector of means for each asset, used for centering.std_vec: Vector of standard deviations for each asset, used for scaling and thresholding.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, compute the centered and scaled returns for assets
iandj.Apply the threshold to classify joint positive, negative, and neutral co-movements.
Use the
sb_deltakernel to accumulate positive (pos), negative (neg), and neutral (nn) contributions, and count the number of positive (cpos), negative (cneg), and neutral (cnn) co-movements.The correlation is computed as
(pos * cpos - neg * cneg) / (pos * cpos + neg * cneg + nn * cnn)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBrobyGerber1, <:Any},
X::AbstractMatrix)Implements the first Gerber-style variant of the Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the StandardisedSmythBrobyGerber1 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive, negative, and neutral co-movements, with additional weighting by the count of co-movements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBrobyGerber1algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive, negative, and neutral co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos), negative (neg), and neutral (nn) contributions, and count the number of positive (cpos), negative (cneg), and neutral (cnn) co-movements.The correlation is computed as
(pos * cpos - neg * cneg) / (pos * cpos + neg * cneg + nn * cnn)if the denominator is nonzero, otherwise zero.The resulting matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:SmythBrobyGerber2, <:Any}, X::AbstractMatrix,
mean_vec::AbstractArray, std_vec::AbstractArray)Implements the second Gerber-style variant of the Smyth-Broby covariance/correlation algorithm (unstandardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the SmythBrobyGerber2 algorithm. The computation is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements, with additional weighting by the count of co-movements. The resulting matrix is then standardised by the geometric mean of its diagonal elements.
Arguments
ce: Smyth-Broby covariance estimator configured with theSmythBrobyGerber2algorithm.X: Data matrix (observations × assets).mean_vec: Vector of means for each asset, used for centering.std_vec: Vector of standard deviations for each asset, used for scaling and thresholding.
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, standardised and projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, compute the centered and scaled returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel to accumulate positive (pos) and negative (neg) contributions, and count the number of positive (cpos) and negative (cneg) co-movements.The raw correlation is computed as
pos * cpos - neg * cneg.The resulting matrix is standardised by dividing each element by the geometric mean of the corresponding diagonal elements.
The matrix is projected to the nearest positive definite matrix using
posdef!.
Related
sourcePortfolioOptimisers.smythbroby Method
smythbroby(ce::SmythBrobyCovariance{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:StandardisedSmythBrobyGerber2, <:Any},
X::AbstractMatrix)Implements the second Gerber-style variant of the Smyth-Broby covariance/correlation algorithm on Z-transformed data (standardised).
This method computes the Smyth-Broby correlation or covariance matrix for the input data matrix X using the StandardisedSmythBrobyGerber2 algorithm. The computation is performed on data that has already been Z-transformed (mean-centered and standardised), and is based on thresholding the data, applying the Smyth-Broby kernel, and aggregating positive and negative co-movements, with additional weighting by the count of co-movements. The resulting matrix is then standardised by the geometric mean of its diagonal elements.
Arguments
ce: Smyth-Broby covariance estimator configured with theStandardisedSmythBrobyGerber2algorithm.X: Z-transformed data matrix (observations × assets).
Returns
rho::Matrix{<:Real}: The Smyth-Broby correlation matrix, standardised and projected to be positive definite using the estimator'spdmfield.
Details
The algorithm proceeds as follows:
For each pair of assets
(i, j), iterate over all observations.For each observation, use the Z-transformed returns for assets
iandj.Apply the threshold to classify joint positive and negative co-movements.
Use the
sb_deltakernel (with mean 0 and standard deviation 1) to accumulate positive (pos) and negative (neg) contributions, and count the number of positive (cpos) and negative (cneg) co-movements.The raw correlation is computed as
pos * cpos - neg * cneg.The resulting matrix is standardised by dividing each element by the geometric mean of the corresponding diagonal elements.
The matrix is projected to the nearest positive definite matrix using
posdef!.
Related
source