Mahalanobis level closure
Types
PortfolioOptimisers.MeanLevelRecursion — Type
struct MeanLevelRecursion <: AbstractLevelRecursionComputes the Mahalanobis bias factor with the level recursion of mahalanobis_level_bias alone, which takes the mean log-determinant of each level inside the exponential. This is the default rule of MahalanobisTarget.
Near the gate the recursion reads 0.2 % to 1.3 % below a Monte Carlo of the statistic, and at the steady state up to about 0.15 % below it, as GaussianLevelRecursion states. It costs one recursion at each node of mahalanobis_bias_nodes.
Constructors
MeanLevelRecursion() -> MeanLevelRecursionExamples
julia> MahalanobisTarget().recursionMeanLevelRecursion()Related
PortfolioOptimisers.GaussianLevelRecursion — Type
struct GaussianLevelRecursion <: AbstractLevelRecursionComputes the Mahalanobis bias factor with a second-order closure of the level recursion, which carries the covariance of the log-determinant of each level as well as its mean.
The level recursion of mahalanobis_level_bias removes one direction at a time, and it takes the deflated weights as fixed: the mean log-determinant $D_{k}$ of each level enters the exponential. Two errors of the second order follow, with opposite signs. The last transform $\mathbb{E}[e^{-F/2}]$ misses $\operatorname{Var}[F] / 8$ in its exponent, and the step of each level reads the mean of a function of a random matrix at the mean of the matrix. At five assets, a half-life of 2 and 10 observations they move the factor of the root mean square by −0.95 % and +0.35 %. The closure takes the log-determinant $F_{k}$ of each level as a Gaussian process with mean $D_{k}$ and covariance $C_{k}$. Each step averages its integrand over that law, and the covariance takes the linear response of the step, which holds the dependence of one level on the levels before it, and the new variance of the removed direction, $K_{\mathrm{int}}$, which is the covariance of the two log-ratios of quadratic forms in one Gaussian direction, in closed form through $D$, $\rho$ and $\rho'$ at the two roots of a quadratic. The last transform reads $e^{-D/2 + C/8}$.
Against a Monte Carlo of 2 million draws of the law of the statistic, at half-lives of 2 to 40, no lag to two lags and two to 12 assets, the factors near the gate read within about two standard errors, where MeanLevelRecursion read 0.2 % to 1.3 % low: at 12 assets, a half-life of 5 and 16 observations, −0.06 %, −0.01 % and +0.02 % against −0.43 %, −0.26 % and −0.12 %, each with a standard error of 0.03 % to 0.06 %. The rest is largest at two assets under HAC at the first count, −0.33 % for the root mean square against −1.2 %, where the law is furthest from a Gaussian.
The closure costs 0.2 s to 0.7 s for each count at 5 to 12 assets, so mahalanobis_recursion_ratio runs it at eight counts and interpolates its ratio to the recursion. The nodes of one count of assets then cost 2 s to 5.4 s, where the recursion alone costs 0.3 s to 0.9 s. Under EstimatedCentring the factor takes the ratio of the pre-centred law. Against a Monte Carlo of a million draws of the statistic, that removes most of the gap of the root mean square and the log under HAC, but the first moment, which reads 0.1 % to 0.2 % high under HAC at 8 and 12 assets, then reads 0.26 % to 0.40 % high. The two rules are under comparison on the forecasts of the estimator, and the closure may be removed if it does not pay its cost.
Constructors
GaussianLevelRecursion() -> GaussianLevelRecursionExamples
julia> MahalanobisTarget(; recursion = GaussianLevelRecursion()).recursionGaussianLevelRecursion()Related
Functions
PortfolioOptimisers.mahalanobis_recursion_ratio — Function
mahalanobis_recursion_ratio(::MeanLevelRecursion, method, decay, Ks, n, hac_lags, start, Ksat)
mahalanobis_recursion_ratio(::GaussianLevelRecursion, method, decay, Ks, n, hac_lags, start, Ksat)The ratio of the Mahalanobis bias factor of a level recursion to the factor of MeanLevelRecursion, at each count of Ks.
The ratio of GaussianLevelRecursion is smooth in $\lambda^{K}$, and it tends to a constant past the saturation: at five assets, a half-life of 10 and two lags it falls from 1.0066 at the gate to 1.0008, and at 12 assets and a half-life of 5 from 1.0037 to 1.0015. Eight Chebyshev–Lobatto points in $\lambda^{K - K_{0}}$ from the gate $K_{0}$ to the saturation hold it, and a barycentric interpolant reads it at each count.
Arguments
method::RegimeAdjustedMethod: Regime adjustment method, which names the moment.decay::Number: Decay of the weights.Ks::AbstractVector{<:Integer}: Counts of observations.n::Integer: Count of assets that contribute to the statistic, at least two.hac_lags::Option{<:Union{<:Integer, <:VecNum}}: Count of HAC lags, the weight of each lag, ornothing.start::Integer: The first count,mahalanobis_bias_start.Ksat::Integer: The count of saturation,mahalanobis_bias_saturation.
Returns
ratio::Option{<:VecNum}:nothingforMeanLevelRecursion, so the factor is not touched, and the ratio at each count ofKsforGaussianLevelRecursion.
Related