Smyth-Broby Covariance
PortfolioOptimisers.BaseSmythBrobyCovariance — Type
abstract type BaseSmythBrobyCovariance <: BaseGerberCovarianceAbstract 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.0Related
References
- [35] W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022). Section 2.
PortfolioOptimisers.SmythBroby0 — Type
struct SmythBroby0 <: SmythBrobyCovarianceAlgorithmDivides 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.
- Read the contribution sums
(pos, neg, nn)from the pair accumulator as the scores(p, q, u). The counts are not read. - Return
(p - q) / (p + q), orzero(T)when the denominator is zero.
Constructors
SmythBroby0() -> SmythBroby0Examples
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.
PortfolioOptimisers.SmythBroby1 — Type
struct SmythBroby1 <: SmythBrobyCovarianceAlgorithmDivides 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.
- Read the contribution sums
(pos, neg, nn)from the pair accumulator as the scores(p, q, u). The counts are not read. - Return
(p - q) / (p + q + u), orzero(T)when the denominator is zero.
Constructors
SmythBroby1() -> SmythBroby1Examples
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.
PortfolioOptimisers.SmythBroby2 — Type
struct SmythBroby2 <: SmythBrobyCovarianceAlgorithmNormalises 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.
- Read the contribution sums
(pos, neg, nn)from the pair accumulator as the scores(p, q, u). - Return the net score
p - qfor every pair, with no denominator. - Divide the assembled matrix by the outer product of the square roots of its own diagonal.
standardise_comovement!clamps each root from below atsqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.
Constructors
SmythBroby2() -> SmythBroby2Examples
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.
PortfolioOptimisers.SmythBrobyGerber0 — Type
struct SmythBrobyGerber0 <: SmythBrobyCovarianceAlgorithmWeights 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.
- Multiply each of
pos,negandnnby its own countcpos,cnegandcnn. The products are the scores(p, q, u). - Return
(p - q) / (p + q), orzero(T)when the denominator is zero.
Constructors
SmythBrobyGerber0() -> SmythBrobyGerber0Examples
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.
PortfolioOptimisers.SmythBrobyGerber1 — Type
struct SmythBrobyGerber1 <: SmythBrobyCovarianceAlgorithmWeights 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.
- Multiply each of
pos,negandnnby its own countcpos,cnegandcnn. The products are the scores(p, q, u). - Return
(p - q) / (p + q + u), orzero(T)when the denominator is zero.
Constructors
SmythBrobyGerber1() -> SmythBrobyGerber1Examples
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.
PortfolioOptimisers.SmythBrobyGerber2 — Type
struct SmythBrobyGerber2 <: SmythBrobyCovarianceAlgorithmWeights 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.
- Multiply each of
pos,negandnnby its own countcpos,cnegandcnn. The products are the scores(p, q, u). - Return the net score
p - qfor every pair, with no denominator. - Divide the assembled matrix by the outer product of the square roots of its own diagonal.
standardise_comovement!clamps each root from below atsqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.
Constructors
SmythBrobyGerber2() -> SmythBrobyGerber2Examples
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.
PortfolioOptimisers.SmythBrobyCount0 — Type
struct SmythBrobyCount0 <: SmythBrobyCovarianceAlgorithmCounts 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.
- Read the counts
(cpos, cneg, cnn)from the pair accumulator as the scores(p, q, u). The contribution sums are not read, andsb_deltais not evaluated. - Return
(p - q) / (p + q), orzero(T)when the denominator is zero.
Constructors
SmythBrobyCount0() -> SmythBrobyCount0Examples
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.
PortfolioOptimisers.SmythBrobyCount1 — Type
struct SmythBrobyCount1 <: SmythBrobyCovarianceAlgorithmCounts 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.
- Read the counts
(cpos, cneg, cnn)from the pair accumulator as the scores(p, q, u). The contribution sums are not read, andsb_deltais not evaluated. - Return
(p - q) / (p + q + u), orzero(T)when the denominator is zero.
Constructors
SmythBrobyCount1() -> SmythBrobyCount1Examples
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.
PortfolioOptimisers.SmythBrobyCount2 — Type
struct SmythBrobyCount2 <: SmythBrobyCovarianceAlgorithmCounts 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.
- Read the counts
(cpos, cneg, cnn)from the pair accumulator as the scores(p, q, u). The contribution sums are not read, andsb_deltais not evaluated. - Return the net score
p - qfor every pair, with no denominator. - Divide the assembled matrix by the outer product of the square roots of its own diagonal.
standardise_comovement!clamps each root from below atsqrt(eps(eltype(rho))), so an asset that admits no observation gives a zero row and no division by zero.
Constructors
SmythBrobyCount2() -> SmythBrobyCount2Examples
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.
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} <: BaseSmythBrobyCovarianceEstimates 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 everyc2.
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 iskappa / (1 + gamma^n), wheregammais the divergence of the pair.
alg: Smyth-Broby covariance algorithm.
ex: Parallel execution strategy.
cache: Optional partial-fit state. It isnothinguntilpartial_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.factorykeeps it unchanged, because a factory call resolves the configuration, not the sample.port_opt_viewcopies the entries of the selected assets into a new state, so the viewed estimator holds the state of those assets alone.obs_weights_viewremoves 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) -> SmythBrobyCovarianceKeywords correspond to the struct's fields.
Validation
0 <= c1.0 <= c2.0 <= c3.c3 > c2.0 <= n.Infis permitted andNaNis not.assert_nonempty_nonneg_finite_valchecksc1,c2andc3, so it refusesInfandNaN.assert_nonnegchecksn. It refuses a negativenandNaN, and it acceptsInf. Atn = Inf,sb_deltagives zero to each observation whose two magnitudes differ by more than one. A negativenreverses the penalty ofsb_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 throughfactory.me: Recursively updated throughfactory.alg: Recursively updated throughfactory.cache: Carried unchanged throughfactory.
View parameters
port_opt_view takes the view of these @vprop fields at the selected indices:
ve: Recursively viewed throughport_opt_view.me: Recursively viewed throughport_opt_view.cache: Sliced to the selected assets throughport_opt_view.
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
BaseSmythBrobyCovarianceAbstractExpectedReturnsEstimatorSimpleExpectedReturnsStatsBase.CovarianceEstimatorSimpleVariancePosdefSmythBrobyCovarianceAlgorithmSmythBroby0SmythBroby1SmythBroby2SmythBrobyGerber0SmythBrobyGerber1SmythBrobyGerber2SmythBrobyCount0SmythBrobyCount1SmythBrobyCount2smythbrobyGerberCovariance: the statistic that this family extends. The confusion zone and the indecision zone replace its threshold.FLoops.Transducers.Executorfactoryport_opt_view
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.
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
- Orient
Xto observations × assets withdims_oriented. - Compute the standard deviation
sdof each column withce.ve, and clamp it from below ateps(eltype(sd)). - Compute the mean
muof each column withce.me. - Build the correlation matrix
sigmawithsmythbrobyfromX,muandsd. - Scale
sigmain place to a covariance matrix withStatsBase.cor2cov!andsd, and return it.
Arguments
ce: Smyth-Broby covariance estimator.X: Data matrixobservations × assetsif thedimskeyword does not exist ordims = 1,assets × observationswhendims = 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
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
- Orient
Xto observations × assets withdims_oriented. - Compute the standard deviation
sdof each column withce.ve, and clamp it from below ateps(eltype(sd)). The clamp prevents a division by zero for a constant column. - Compute the mean
muof each column withce.me. - Return the matrix that
smythbrobybuilds fromX,muandsd.
Arguments
ce: Smyth-Broby covariance estimator.X: Data matrixobservations × assetsif thedimskeyword does not exist ordims = 1,assets × observationswhendims = 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
References
- [35]
- W. Smyth and D. Broby. An enhanced Gerber statistic for portfolio optimization. Finance Research Letters 49, 103229 (2022).