Asset Phylogeny

PortfolioOptimisers.asset_phylogeny — Function
asset_phylogeny(w::VecNum, X::MatNum)

Compute the asset phylogeny score of the weights w on the phylogeny matrix X.

The score is the share of the gross weight of all pairs that the related pairs hold. It is the percentage invested in connected assets of Equation 13.7 of [12],

\[\begin{align} \mathrm{CA}(\boldsymbol{x}) &= \dfrac{\boldsymbol{1}_n^{\intercal} \left(\mathbf{B}_{1,\,l} \odot \lvert \boldsymbol{x}\boldsymbol{x}^{\intercal} \rvert\right) \boldsymbol{1}_n}{\boldsymbol{1}_n^{\intercal} \lvert \boldsymbol{x}\boldsymbol{x}^{\intercal} \rvert \boldsymbol{1}_n}\,, \end{align}\]

Where:

  • $\mathbf{B}_{1,\,l}$: Phylogeny matrix from phylogeny_matrix.
  • $\odot$: Hadamard, element-wise product.
  • $\boldsymbol{x}$: Portfolio weight vector.
  • $\boldsymbol{1}_n$: Column vector of ones of length $n$.

A pair of assets that are not related adds nothing, and a pair adds nothing when either weight is zero. A w of zeros gives NaN, because the denominator is zero.

Algorithm

  1. Take the absolute value of the outer product of w with itself. The result aw is the gross weight of every pair.
  2. Take the dot product of X and aw, which adds up the gross weight of the related pairs.
  3. Divide by the sum of aw, and return the share invested in related assets.

Arguments

  • w: Portfolio weight vector.
  • X: Phylogeny matrix.

Returns

  • p::Number: Asset phylogeny score.

Related

References

  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 13.1.5.2, Equation 13.7.
source
asset_phylogeny(pl::PhylogenyResult{<:MatNum}, w::VecNum, args...;
                kwargs...)

Compute the asset phylogeny score of the weights w on a precomputed phylogeny matrix.

The method calls asset_phylogeny(w, pl.X). It accepts args and kwargs and does not read them, so a caller can pass a precomputed result where it passes an estimator and its data.

Arguments

  • pl::PhylogenyResult{<:MatNum}: Precomputed phylogeny matrix.
  • w::VecNum: Portfolio weight vector.
  • args...: Positional arguments. The method does not read them.
  • kwargs...: Keyword arguments. The method does not read them.

Returns

  • score::Number: Asset phylogeny score.

Related

source
asset_phylogeny(cle::NwE_ClE_Cl,
                w::VecNum, X::MatNum; dims::Int = 1, kwargs...)

Compute the asset phylogeny score of the weights w on the phylogeny matrix that cle builds from X.

Algorithm

  1. Build the phylogeny matrix from X with phylogeny_matrix.
  2. Score w against that matrix with asset_phylogeny.

Arguments

  • cle: Network estimator, clustering estimator, or clustering result.
  • w: Portfolio weight vector.
  • 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...: Additional keyword arguments.

Returns

  • p::Number: Asset phylogeny score.

Related

source
asset_phylogeny(pl::NwE_ClE_Cl,
                w::VecNum, pr::AbstractPriorResult; kwargs...)

Compute the asset phylogeny score for a portfolio allocation using a phylogeny estimator or clustering result and a prior result.

This function computes the phylogeny matrix from the asset returns in the prior result using the specified phylogeny estimator or clustering result, then evaluates the asset phylogeny score for the given portfolio weights. The asset phylogeny score quantifies the degree of phylogenetic (network or cluster-based) structure present in the portfolio allocation.

Algorithm

  1. Pick the asset returns matrix X from the source that the reader states, returns_source, with returns_matrix_picker. Refuse a gap in X that a plain graph reader cannot read, with assert_graph_readable.
  2. Call the asset-returns method of asset_phylogeny with X, passing both results on as pr and rd and dims = 1 last, and return the score it produces.

Arguments

  • pl: Phylogeny estimator or clustering result used to compute the phylogeny matrix.
  • w: Portfolio weights vector.
  • pr: Prior result or returns result. Both carry the asset returns matrix X, so either can supply it.
  • rd: The returns result to use. Read for X under the source of the reader, and passed on to the estimator tree.
  • iv: Optional implied volatility matrix, observations × assets, read by an ImpliedVolatility estimator in the tree. The estimator receives the last rows of iv, one for each row of the picked X, through implied_volatility_picker, so a prior that keeps fewer rows than the returns data still pairs each row of its X with the implied volatility of the same observation.
  • kwargs...: Additional keyword arguments passed to the phylogeny matrix computation. An unknown keyword raises a MethodError, see graph_verb_keywords.

Returns

  • score::Number: Asset phylogeny score.

Related

source

References

[12]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).