Brownian Distance Variance

PortfolioOptimisers.NormOneConeBrownianDistanceVariance — Type
struct NormOneConeBrownianDistanceVariance <: BrownianDistanceVarianceFormulation

Bounds each distance of a BrownianDistanceVariance model with a norm-one cone of dimension two.

The model adds one cone for each pair of observations on or below the diagonal, $T (T + 1) / 2$ cones in all. This is the default. Model 10 of [215] states the same bound as two linear inequalities, which IneqBrownianDistanceVariance selects.

Mathematical definition

\[\begin{align} (D_{ij},\, x_i - x_j) &\in \mathcal{K}_{1}\,, \quad \forall\, 1 \leq j \leq i \leq T\,. \end{align}\]

Where:

  • $D_{ij}$: Entry of the symmetric matrix variable of the distances between the portfolio returns.
  • $x_i$, $x_j$: Portfolio returns at the periods $i$ and $j$.
  • $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
  • $T$: Number of observations.

The cone states $D_{ij} \geq |x_i - x_j|$.

Related

source
PortfolioOptimisers.IneqBrownianDistanceVariance — Type
struct IneqBrownianDistanceVariance <: BrownianDistanceVarianceFormulation

Bounds each distance of a BrownianDistanceVariance model with two linear inequalities.

The model adds two matrix rows of $T^2$ inequalities each. These are the rows of model 10 of [215]. The difference matrix is antisymmetric and the distance matrix is symmetric, so the entry $(j, i)$ of each matrix row repeats the entry $(i, j)$ of the other.

Mathematical definition

\[\begin{align} \mathbf{D} - \left( \boldsymbol{x} \boldsymbol{1}^\intercal - \boldsymbol{1} \boldsymbol{x}^\intercal \right) &\geq 0\,, \\ \mathbf{D} + \left( \boldsymbol{x} \boldsymbol{1}^\intercal - \boldsymbol{1} \boldsymbol{x}^\intercal \right) &\geq 0\,. \end{align}\]

Where:

  • $\mathbf{D}$: Symmetric $T \times T$ matrix variable of the distances between the portfolio returns.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $\boldsymbol{1}$: Column vector of ones, $T \times 1$.

Each inequality holds entry by entry, and together they state $D_{ij} \geq |x_i - x_j|$.

Related

source
PortfolioOptimisers.BrownianDistanceVariance — Type
struct BrownianDistanceVariance{__T_settings, __T_alg1, __T_alg2} <: RiskMeasure

Represents the Brownian Distance Variance (BDVar) risk measure.

BrownianDistanceVariance measures the dispersion of the portfolio return series through its distance variance, the Brownian distance covariance of the series with itself. It is built from the pairwise distances between observations rather than from their deviations about the mean, so it reads non-linear structure that the variance cannot see. The functor and the optimisation model both return a disciplined-convex upper bound on that statistic, not the statistic itself.

Mathematical definition

Given a portfolio returns vector $\boldsymbol{x} = (x_1, \ldots, x_T)^\intercal$, define the pairwise absolute distance matrix, the centring matrix, and the doubly centred distance matrix:

\[\begin{align} D_{ij} &= |x_i - x_j|\,, \\ \mathbf{C}_T &= \mathbf{I}_T - \frac{1}{T} \boldsymbol{1}_T \boldsymbol{1}_T^\intercal\,, \\ \mathbf{A} &= \mathbf{C}_T \mathbf{D} \mathbf{C}_T\,. \end{align}\]

Where:

  • $D_{ij}$: Pairwise absolute distance between returns at periods $i$ and $j$.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.
  • $\mathbf{D}$: $T \times T$ pairwise distance matrix.
  • $\mathbf{C}_T$: $T \times T$ centring matrix.
  • $\mathbf{A}$: $T \times T$ doubly centred distance matrix.
  • $\boldsymbol{1}_T$: Column vector of ones, $T \times 1$.

The distance variance is the mean square of the centred matrix, $\mathcal{V}_n^2$ of equation 2.9 of [37]:

\[\begin{align} \mathrm{dVar}(\boldsymbol{x}) &= \frac{1}{T^2} \lVert \mathbf{A} \rVert_F^2 = \frac{1}{T^2} \left( \mathrm{tr}\left( \mathbf{D}^\intercal \mathbf{D} \left( \mathbf{I}_T - \frac{2}{T} \boldsymbol{1}_T \boldsymbol{1}_T^\intercal \right) \right) + \frac{1}{T^2} \left( \boldsymbol{1}_T^\intercal \mathbf{D} \boldsymbol{1}_T \right)^2 \right)\,. \end{align}\]

Where:

  • $\mathrm{dVar}(\boldsymbol{x})$: Distance variance.
  • $\lVert \cdot \rVert_F$: Frobenius norm.

$\mathbf{I}_T - \frac{2}{T} \boldsymbol{1}_T \boldsymbol{1}_T^\intercal$ is indefinite, with eigenvalues $1$ and $-1$, so that expression is not disciplined-convex and no solver takes it directly. The trace inequality $\mathrm{tr}(\mathbf{A}\mathbf{B}) \leq \lambda_{\max}(\mathbf{A}) \mathrm{tr}(\mathbf{B})$ holds for a symmetric $\mathbf{A}$ and a positive semi-definite $\mathbf{B}$, and here $\lambda_{\max} = 1$. This gives the disciplined-convex upper bound that this type computes, equation 9 of [215]:

\[\begin{align} \mathrm{BDVar}(\boldsymbol{x}) &= \frac{1}{T^2} \left( \lVert \mathbf{D} \rVert_F^2 + \frac{1}{T^2} \left( \sum_{i,j} D_{ij} \right)^2 \right) \geq \mathrm{dVar}(\boldsymbol{x})\,. \end{align}\]

Where:

  • $\mathrm{BDVar}(\boldsymbol{x})$: The upper bound on the distance variance, and the value this type reports.

The bound and its gap to the distance variance have closed forms:

\[\begin{align} \mathrm{BDVar}(\boldsymbol{x}) &= 2 \sigma^2(\boldsymbol{x}) + \bar{D}^2\,, \\ \mathrm{BDVar}(\boldsymbol{x}) - \mathrm{dVar}(\boldsymbol{x}) &= \frac{2}{T^3} \lVert \mathbf{D} \boldsymbol{1}_T \rVert_2^2\,. \end{align}\]

Where:

  • $\sigma^2(\boldsymbol{x}) = \frac{1}{T} \sum_{i} (x_i - \bar{x})^2$: Variance of the portfolio returns, with the divisor $T$, and $\bar{x}$ their mean.
  • $\bar{D} = \frac{1}{T^2} \sum_{i,j} D_{ij}$: Mean pairwise distance.

The gap is zero only when $\mathbf{D}$ is zero, that is, for a constant series, where both values are zero. Otherwise the bound is several times the statistic: on Gaussian returns at $T = 50$ it is 6.9 times the distance variance.

The functor and set_risk_constraints! compute the same bound, so a reported figure and the objective the optimiser minimised are the same quantity.

Fields

  • settings: Risk measure settings.
  • alg1: First algorithm variant.
  • alg2: Second algorithm variant.

Constructors

BrownianDistanceVariance(;    settings::RiskMeasureSettings = RiskMeasureSettings(),    alg1::BDVarRkFormulations = QuadRiskExpr(),    alg2::BrownianDistanceVarianceFormulation = NormOneConeBrownianDistanceVariance()) -> BrownianDistanceVariance

Keywords correspond to the struct's fields.

Functor

(r::BrownianDistanceVariance)(x::VecNum)

Computes $\mathrm{BDVar}(\boldsymbol{x})$, the upper bound on the distance variance of a portfolio returns vector x.

Arguments

  • x::VecNum: Portfolio returns vector. expected_risk passes the returns net of fees.

Examples

julia> BrownianDistanceVariance()BrownianDistanceVariance  settings ┼ RiskMeasureSettings           │   scale ┼ Float64: 1.0           │      ub ┼ nothing           │     rke ┴ Bool: true      alg1 ┼ QuadRiskExpr()      alg2 ┴ NormOneConeBrownianDistanceVariance()

Related

References

  • [37] G. J. Székely, M. L. Rizzo and N. K. Bakirov. Measuring and testing dependence by correlation of distances. The Annals of Statistics 35, 2769–2794 (2007).
  • [215] D. Cajas. Portfolio Optimization of Brownian Distance Variance. Available at SSRN 4561293 (2023).
source

References

[37]
G. J. Székely, M. L. Rizzo and N. K. Bakirov. Measuring and testing dependence by correlation of distances. The Annals of Statistics 35, 2769–2794 (2007).
[215]
D. Cajas. Portfolio Optimization of Brownian Distance Variance. Available at SSRN 4561293 (2023).