Smyth-Broby Covariance

PortfolioOptimisers.BaseSmythBrobyCovariance — Type
abstract type BaseSmythBrobyCovariance <: BaseGerberCovariance

Abstract supertype for all Smyth-Broby covariance estimators.

Every concrete or abstract type that implements a Smyth-Broby covariance estimator must subtype BaseSmythBrobyCovariance. It subtypes BaseGerberCovariance, because a Smyth-Broby statistic is a Gerber statistic with a second zone. Each observation adds a real-valued contribution to it, not a count of one. GerberCovariance states the Gerber statistic, and this docstring does not repeat it.

Interfaces

A new subtype must follow the interface of AbstractCovarianceEstimator.

Examples

This subtype holds a SmythBrobyCovariance and doubles its covariance matrix. Its correlation matrix is that of the estimator it holds.

julia> struct MySmythBroby{T} <: PortfolioOptimisers.BaseSmythBrobyCovariance           ce::T       endjulia> function Statistics.cov(est::MySmythBroby, X::PortfolioOptimisers.MatNum; kwargs...)           return 2 * cov(est.ce, X; kwargs...)       endjulia> function Statistics.cor(est::MySmythBroby, X::PortfolioOptimisers.MatNum; kwargs...)           return cor(est.ce, X; kwargs...)       endjulia> function PortfolioOptimisers.factory(est::MySmythBroby, w::PortfolioOptimisers.ObsWeights)           return MySmythBroby(PortfolioOptimisers.factory(est.ce, w))       endjulia> X = [0.01 0.02 -0.01; -0.02 0.01 0.03; 0.03 -0.01 0.02; 0.01 0.0 -0.02;            -0.01 0.02 0.01; 0.02 0.01 0.0];julia> ce = MySmythBroby(SmythBrobyCovariance());julia> cov(ce, X) == 2 * cov(SmythBrobyCovariance(), X)truejulia> cor(ce, X)3×3 Matrix{Float64}:  1.0        -0.357035  -0.0336873 -0.357035    1.0       -0.438569 -0.0336873  -0.438569   1.0

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2.
source
PortfolioOptimisers.SmythBroby0 — Type
struct SmythBroby0 <: SmythBrobyCovarianceAlgorithm

Divides the difference of the concordant and discordant Smyth-Broby contribution sums by their sum.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos},\, \mathrm{neg},\, \mathrm{nn})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The source defines one statistic, SmythBroby1, and that statistic keeps the neutral sum in the denominator. This marker removes the neutral term, as Gerber0 does. It is a reduction of the library, not a formulation of the source.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Read the contribution sums (pos, neg, nn) from the pair accumulator as the scores (p, q, u). The counts are not read.
  2. Return (p - q) / (p + q), or zero(T) when the denominator is zero.

Constructors

SmythBroby0() -> SmythBroby0

Examples

julia> SmythBroby0()SmythBroby0()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equation 5.
source
PortfolioOptimisers.SmythBroby1 — Type
struct SmythBroby1 <: SmythBrobyCovarianceAlgorithm

Divides the difference of the concordant and discordant Smyth-Broby contribution sums by their sum plus the neutral sum.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos},\, \mathrm{neg},\, \mathrm{nn})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q + u}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

This is Equation 5 of [35], and it is the only statistic that the source defines. The numerator is the concordant sum minus the discordant sum over the lookback window. The denominator adds the concordant, discordant and neutral sums. The neutral zone is the four regions DN, NU, UN and ND of Section 2 of the source. These are the observations on which exactly one asset leaves the indecision zone.

Section 2 of the source states that the neutral sum keeps the covariance matrix positive semidefinite, and its footnote 2 states that this has no proof. The claim is false. On a sample of 30 observations of 20 standard normal returns, the matrix of this marker has a negative eigenvalue. The pdm field of SmythBrobyCovariance repairs it.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Read the contribution sums (pos, neg, nn) from the pair accumulator as the scores (p, q, u). The counts are not read.
  2. Return (p - q) / (p + q + u), or zero(T) when the denominator is zero.

Constructors

SmythBroby1() -> SmythBroby1

Examples

julia> SmythBroby1()SmythBroby1()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equation 5.
source
PortfolioOptimisers.SmythBroby2 — Type
struct SmythBroby2 <: SmythBrobyCovarianceAlgorithm

Normalises the net Smyth-Broby contribution of a pair by the geometric mean of its own diagonal.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos},\, \mathrm{neg},\, \mathrm{nn})\,, \\ \rho_{i,\,j} &= \frac{h_{i,\,j}}{\sqrt{h_{i,\,i} \, h_{j,\,j}}}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $h_{i,\,j} = p - q$: Net score of the pair, before any division.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The denominator comes from the diagonal of the whole matrix, not from the sums of the pair alone. SmythBroby0 and SmythBroby1 divide by the sums of the pair. The diagonal of the result is therefore one by construction. The result is not the ratio of SmythBroby0 after a second division. The two are equal only where $p + q$ is the same for every pair. The source defines no such denominator, so this marker is a reduction of the library, as Gerber2 is for the Gerber statistic.

Algorithm

The branch of sb_pair_scores, of comovement_ratio and of standardise_comovement! that this marker selects runs these steps.

  1. Read the contribution sums (pos, neg, nn) from the pair accumulator as the scores (p, q, u).
  2. Return the net score p - q for every pair, with no denominator.
  3. Divide the assembled matrix by the outer product of the square roots of its own diagonal. standardise_comovement! clamps each root from below at sqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.

Constructors

SmythBroby2() -> SmythBroby2

Examples

julia> SmythBroby2()SmythBroby2()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equations 1 to 4.
source
PortfolioOptimisers.SmythBrobyGerber0 — Type
struct SmythBrobyGerber0 <: SmythBrobyCovarianceAlgorithm

Weights each Smyth-Broby contribution sum by its own observation count, then divides the difference by the sum.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos} \, c^{+},\, \mathrm{neg} \, c^{-},\, \mathrm{nn} \, c^{0})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The counts are the Gerber co-movement counts that SmythBroby0 does not read. A pair that moves together often therefore scores above a pair that moves together rarely but by large amounts. This marker removes the neutral term, as SmythBroby0 does.

Section 5 of [35] suggests a count beside each sum, and a scale on the total contribution to match the total count. The scale keeps the split between the concordant, discordant and neutral contributions. Section 5 states no formula. One factor on all three sums does not change the ratio of Equation 5. The product of each sum with its own count is therefore a choice of the library, and it does not follow from Section 5.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Multiply each of pos, neg and nn by its own count cpos, cneg and cnn. The products are the scores (p, q, u).
  2. Return (p - q) / (p + q), or zero(T) when the denominator is zero.

Constructors

SmythBrobyGerber0() -> SmythBrobyGerber0

Examples

julia> SmythBrobyGerber0()SmythBrobyGerber0()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equations 4 and 5, and Section 5.
source
PortfolioOptimisers.SmythBrobyGerber1 — Type
struct SmythBrobyGerber1 <: SmythBrobyCovarianceAlgorithm

Weights each Smyth-Broby contribution sum by its own count, then divides the difference by the sum plus the neutral term.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos} \, c^{+},\, \mathrm{neg} \, c^{-},\, \mathrm{nn} \, c^{0})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q + u}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The neutral sum also gets its own count, so each of the three terms of the denominator is a product of a sum and a count. This is the default algorithm of the estimator. It applies the count that Section 5 of the source suggests to the statistic of the source, SmythBroby1. The source states no formula for that product.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Multiply each of pos, neg and nn by its own count cpos, cneg and cnn. The products are the scores (p, q, u).
  2. Return (p - q) / (p + q + u), or zero(T) when the denominator is zero.

Constructors

SmythBrobyGerber1() -> SmythBrobyGerber1

Examples

julia> SmythBrobyGerber1()SmythBrobyGerber1()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equations 4 and 5, and Section 5.
source
PortfolioOptimisers.SmythBrobyGerber2 — Type
struct SmythBrobyGerber2 <: SmythBrobyCovarianceAlgorithm

Weights each Smyth-Broby contribution sum by its own count, then normalises the net score by the geometric mean of its own diagonal.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (\mathrm{pos} \, c^{+},\, \mathrm{neg} \, c^{-},\, \mathrm{nn} \, c^{0})\,, \\ \rho_{i,\,j} &= \frac{h_{i,\,j}}{\sqrt{h_{i,\,i} \, h_{j,\,j}}}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $\mathrm{pos}$, $\mathrm{neg}$, $\mathrm{nn}$: Contribution sums of a pair over $C$, $D$ and $N$.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $h_{i,\,j} = p - q$: Net score of the pair, before any division.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The denominator comes from the diagonal of the whole matrix, as in SmythBroby2. The source defines no such denominator, so this marker is a reduction of the library, as Gerber2 is for the Gerber statistic.

Algorithm

The branch of sb_pair_scores, of comovement_ratio and of standardise_comovement! that this marker selects runs these steps.

  1. Multiply each of pos, neg and nn by its own count cpos, cneg and cnn. The products are the scores (p, q, u).
  2. Return the net score p - q for every pair, with no denominator.
  3. Divide the assembled matrix by the outer product of the square roots of its own diagonal. standardise_comovement! clamps each root from below at sqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.

Constructors

SmythBrobyGerber2() -> SmythBrobyGerber2

Examples

julia> SmythBrobyGerber2()SmythBrobyGerber2()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equations 4 and 5, and Section 5.
source
PortfolioOptimisers.SmythBrobyCount0 — Type
struct SmythBrobyCount0 <: SmythBrobyCovarianceAlgorithm

Counts concordant and discordant observations, discards the contribution sums, and divides their difference by their sum.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (c^{+},\, c^{-},\, c^{0})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

Without sb_delta, the statistic is a Gerber statistic on the zones of Smyth-Broby, not on the Gerber threshold. This marker gives the same matrix as Gerber0 when c1 is zero, c2 is the Gerber threshold t, c3 is above every return, and the mean of each asset is zero. Equation 5 of the source adds contributions and keeps no count, because the source argues that a contribution sum holds more information than a count. The count family is therefore a construction of the library, not a formulation of the source.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Read the counts (cpos, cneg, cnn) from the pair accumulator as the scores (p, q, u). The contribution sums are not read, and sb_delta is not evaluated.
  2. Return (p - q) / (p + q), or zero(T) when the denominator is zero.

Constructors

SmythBrobyCount0() -> SmythBrobyCount0

Examples

julia> SmythBrobyCount0()SmythBrobyCount0()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2.
source
PortfolioOptimisers.SmythBrobyCount1 — Type
struct SmythBrobyCount1 <: SmythBrobyCovarianceAlgorithm

Counts concordant, discordant and neutral observations, discards the contribution sums, and divides the net count by the total.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (c^{+},\, c^{-},\, c^{0})\,, \\ \rho_{i,\,j} &= \frac{p - q}{p + q + u}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

Without sb_delta, the statistic is a Gerber statistic on the zones of Smyth-Broby, not on the Gerber threshold. This marker gives the same matrix as Gerber1 when c1 is zero, c2 is the Gerber threshold t, c3 is above every return, and the mean of each asset is zero. Equation 5 of the source keeps no count, so the count family is a construction of the library, not a formulation of the source.

Algorithm

The branch of sb_pair_scores and of comovement_ratio that this marker selects runs these steps.

  1. Read the counts (cpos, cneg, cnn) from the pair accumulator as the scores (p, q, u). The contribution sums are not read, and sb_delta is not evaluated.
  2. Return (p - q) / (p + q + u), or zero(T) when the denominator is zero.

Constructors

SmythBrobyCount1() -> SmythBrobyCount1

Examples

julia> SmythBrobyCount1()SmythBrobyCount1()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2.
source
PortfolioOptimisers.SmythBrobyCount2 — Type
struct SmythBrobyCount2 <: SmythBrobyCovarianceAlgorithm

Counts concordant and discordant observations, discards the contribution sums, and normalises the net count by the geometric mean of its own diagonal.

Mathematical definition

\[\begin{align} (p,\, q,\, u) &= (c^{+},\, c^{-},\, c^{0})\,, \\ \rho_{i,\,j} &= \frac{h_{i,\,j}}{\sqrt{h_{i,\,i} \, h_{j,\,j}}}\,. \end{align}\]

Where:

  • $p$, $q$, $u$: Concordant, discordant and neutral scores of a pair. The marker prefix selects them from the sums and the counts.
  • $c^{+}$, $c^{-}$, $c^{0}$: Observation counts of a pair over $C$, $D$ and $N$.
  • $h_{i,\,j} = p - q$: Net score of the pair, before any division.
  • $\rho_{i,\,j}$: Pairwise correlation coefficient between assets $i$ and $j$.

The denominator comes from the diagonal of the whole matrix, as in SmythBroby2. This marker gives the same matrix as Gerber2 when c1 is zero, c2 is the Gerber threshold t, c3 is above every return, and the mean of each asset is zero. The source keeps no count and defines no such denominator, so this marker is a construction of the library.

Algorithm

The branch of sb_pair_scores, of comovement_ratio and of standardise_comovement! that this marker selects runs these steps.

  1. Read the counts (cpos, cneg, cnn) from the pair accumulator as the scores (p, q, u). The contribution sums are not read, and sb_delta is not evaluated.
  2. Return the net score p - q for every pair, with no denominator.
  3. Divide the assembled matrix by the outer product of the square roots of its own diagonal. standardise_comovement! clamps each root from below at sqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.

Constructors

SmythBrobyCount2() -> SmythBrobyCount2

Examples

julia> SmythBrobyCount2()SmythBrobyCount2()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2.
source
PortfolioOptimisers.SmythBrobyCovariance — Type
struct SmythBrobyCovariance{__T_ve, __T_me, __T_pdm, __T_c1, __T_c2, __T_c3, __T_n, __T_alg, __T_ex, __T_cache} <: BaseSmythBrobyCovariance

Estimates a covariance matrix from the co-movements of each pair of assets outside a confusion zone and an indecision zone.

Each entry of a Smyth-Broby matrix is a separate ratio of one pair, so the matrix is not positive definite in general. The pdm field projects the result onto the nearest positive definite matrix, and pdm = nothing returns the statistic with no repair. Of the nine markers, the source defines only SmythBroby1. The docstring of each other marker states what the library adds to the source. smythbroby states the shared statistic once.

Fields

  • ve: Variance estimator.
  • me: Expected returns estimator. Its mean centres the returns before the indecision-zone test and the outer cut-off.
  • pdm: Positive definite matrix estimator.
  • c1: Confusion-zone threshold on the raw, uncentred return, in standard deviations of the asset. The confusion zone rejects an observation only when both assets are inside it.
  • c2: Indecision-zone threshold on the centred, standardised return, in standard deviations of the asset. The indecision zone rejects an observation when both assets are inside it. A centred return of exactly zero is inside the zone at every c2.
  • c3: Outer cut-off on the centred, standardised return, in standard deviations of the asset. The cut-off rejects an observation when either asset is above it.
  • n: Severity exponent of the Smyth-Broby contribution. The contribution of an observation is kappa / (1 + gamma^n), where gamma is the divergence of the pair.
  • alg: Smyth-Broby covariance algorithm.
  • ex: Parallel execution strategy.
  • cache: Optional partial-fit state. It is nothing until partial_fit! writes one. When the caller gives no data matrix, the batch verb of the estimator reads it. Each propagation channel does one thing with it. factory keeps it unchanged, because a factory call resolves the configuration, not the sample. port_opt_view copies the entries of the selected assets into a new state, so the viewed estimator holds the state of those assets alone. obs_weights_view removes it, because a state has no slice on the observation axis. Only a type with an observation-weights field has that channel. A type with no such field falls through to the identity method, so it keeps its state. A family whose state has no exact asset slice removes it on both axes and names the reason.

Constructors

SmythBrobyCovariance(;    ve::StatsBase.CovarianceEstimator = SimpleVariance(),    me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),    pdm::Option{<:AbstractPosdefEstimator} = Posdef(),    c1::Number = 0.5,    c2::Number = 0.5,    c3::Number = 4,    n::Number = 2,    alg::SmythBrobyCovarianceAlgorithm = SmythBrobyGerber1(),    ex::FLoops.Transducers.Executor = ThreadedEx(),    cache::Option{<:AbstractPartialFitState} = nothing) -> SmythBrobyCovariance

Keywords correspond to the struct's fields.

Validation

  • 0 <= c1.
  • 0 <= c2.
  • 0 <= c3.
  • c3 > c2.
  • 0 <= n. Inf is permitted and NaN is not.
  • assert_nonempty_nonneg_finite_val checks c1, c2 and c3, so it refuses Inf and NaN. assert_nonneg checks n. It refuses a negative n and NaN, and it accepts Inf. At n = Inf, sb_delta gives zero to each observation whose two magnitudes differ by more than one. A negative n reverses the penalty of sb_delta. An observation with two equal magnitudes then contributes zero, so the diagonal is zero, not one.

Propagated parameters

factory passes its arguments on to these @fprop fields:

  • ve: Recursively updated through factory.
  • me: Recursively updated through factory.
  • alg: Recursively updated through factory.
  • cache: Carried unchanged through factory.

View parameters

port_opt_view takes the view of these @vprop fields at the selected indices:

Examples

julia> SmythBrobyCovariance()SmythBrobyCovariance   ve ┼ SimpleVariance      │          me ┼ SimpleExpectedReturns      │             │   w ┴ nothing      │           w ┼ nothing      │   corrected ┴ Bool: true   me ┼ SimpleExpectedReturns      │   w ┴ nothing  pdm ┼ Posdef      │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton      │   kwargs ┴ @NamedTuple{}: NamedTuple()   c1 ┼ Float64: 0.5   c2 ┼ Float64: 0.5   c3 ┼ Int64: 4    n ┼ Int64: 2  alg ┼ SmythBrobyGerber1()   ex ┴ Transducers.ThreadedEx{@NamedTuple{}}: Transducers.ThreadedEx()

Related

References

  • [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2, Equations 1 to 5, and Section 3.
source
Statistics.cov — Method
Statistics.cov(ce::SmythBrobyCovariance, X::MatNum; dims::Int = 1, kwargs...)

Compute the Smyth-Broby covariance matrix.

The method scales the correlation matrix by the same sd that the zones use. The covariance is therefore exactly the correlation times the outer product of sd, and its diagonal is exactly sd .^ 2.

Algorithm

  1. Orient X to observations × assets with dims_oriented.
  2. Compute the standard deviation sd of each column with ce.ve, and clamp it from below at eps(eltype(sd)).
  3. Compute the mean mu of each column with ce.me.
  4. Build the correlation matrix sigma with smythbroby from X, mu and sd.
  5. Scale sigma in place to a covariance matrix with StatsBase.cor2cov! and sd, and return it.

Arguments

  • ce: Smyth-Broby covariance estimator.
  • X: Data matrix observations × assets if the dims keyword does not exist or dims = 1, assets × observations when dims = 2.
  • dims: Dimension along which the computation runs.
  • kwargs...: Keyword arguments for the mean estimator and for the standard deviation estimator.

Validation

  • dims in (1, 2).

Returns

  • sigma::Matrix{<:Number}: The Smyth-Broby covariance matrix.

Related

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

Compute the Smyth-Broby correlation matrix.

The me and ve fields of the estimator compute the mean and the standard deviation. The estimator, not this method, therefore sets the centre and the scale of the zones.

Algorithm

  1. Orient X to observations × assets with dims_oriented.
  2. Compute the standard deviation sd of each column with ce.ve, and clamp it from below at eps(eltype(sd)). The clamp prevents a division by zero for a constant column.
  3. Compute the mean mu of each column with ce.me.
  4. Return the matrix that smythbroby builds from X, mu and sd.

Arguments

  • ce: Smyth-Broby covariance estimator.
  • X: Data matrix observations × assets if the dims keyword does not exist or dims = 1, assets × observations when dims = 2.
  • dims: Dimension along which the computation runs.
  • kwargs...: Keyword arguments for the mean estimator and for the standard deviation estimator.

Validation

  • dims in (1, 2).

Returns

  • rho::Matrix{<:Number}: The Smyth-Broby correlation matrix.

Related

source

References

[35]
W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022).