Asset Phylogeny
PortfolioOptimisers.asset_phylogeny — Function
asset_phylogeny(w::VecNum, X::MatNum)Compute the asset phylogeny score for a set of weights and a phylogeny matrix.
This function computes the weighted sum of the phylogeny matrix, normalised by the sum of absolute weights. The asset phylogeny score quantifies the degree of phylogenetic (network or cluster-based) structure present in the portfolio allocation. It is the percentage invested in connected assets of NetworkEstimator's Equation 13.7,
\[\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$.
Two assets that are not related contribute nothing, and a pair contributes nothing when either weight is zero.
Algorithm
- Take the outer product of
wwith itself and its absolute value, givingaw, the gross weight of every pair. - Take the dot product of
Xandaw, which adds up the gross weight of the related pairs alone. - Divide by the sum of
aw, the gross weight of every pair, giving the share invested in related assets.
Arguments
w: Weights vector.X: Phylogeny matrix.
Returns
p::Number: Asset phylogeny score.
Related
asset_phylogeny(pl::PhylogenyResult{<:MatNum}, w::VecNum, args...;
kwargs...)Compute the asset phylogeny score for a set of portfolio weights and a phylogeny matrix result, forwarding additional arguments.
This method provides compatibility with workflows that pass extra positional or keyword arguments. It extracts the phylogeny matrix from the PhylogenyResult and delegates to asset_phylogeny(w, pl), ignoring any additional arguments.
Arguments
pl::PhylogenyResult{<:MatNum}: Phylogeny matrix result object.w::VecNum: Portfolio weights vector.args...: Additional positional arguments (ignored).kwargs...: Additional keyword arguments (ignored).
Returns
score::Number: Asset phylogeny score.
Related
asset_phylogeny(cle::NwE_ClE_Cl,
w::VecNum, X::MatNum; dims::Int = 1, kwargs...)Compute the asset phylogeny score for a set of weights and a network or clustering estimator.
This function computes the phylogeny matrix using the estimator and data, then computes the asset phylogeny score using the weights.
Algorithm
- Build the phylogeny matrix from
Xwithphylogeny_matrix. - Score
wagainst that matrix withasset_phylogeny.
Arguments
cle: NetworkEstimator or clustering estimator.w: Weights vector.X: Data matrix (observations × assets).dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments.
Returns
p::Number: Asset phylogeny score.
Related
asset_phylogeny(pl::NwE_ClE_Cl,
w::VecNum, pr::AbstractPriorResult; dims::Int = 1, 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
- Pick the asset returns matrix
Xfrom the carrier thatx_srcnames, withreturns_matrix_picker. - Call the asset-returns method of
asset_phylogenywithX, passing both carriers on asprandrd, 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 matrixXand the feature matrixZ, so either can supply them.rd: The returns result to use. Read forXonly whenx_srcis:data, and passed on to the estimator tree.x_src: Which returns matrix the clustering, phylogeny and centrality estimators read::priortakes the prior result'sX,:datatakes the raw returns result'sX. Ignored when no returns result is available, in which case the prior result'sXis used.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the phylogeny matrix computation.
Returns
score::Number: Asset phylogeny score.
Related
phylogeny_matrixAbstractPhylogenyEstimatorAbstractClusteringResultAbstractPriorResultPr_RRreturns_matrix_pickerasset_phylogeny: The asset-returns methods this one delegates to. They build the phylogeny matrix, add up the gross weight of the related pairs, and divide by the gross weight of every pair. That is where the score's closed form and its numbered steps are stated.