Compact Radius Rules: private API

PortfolioOptimisers.compact_radius_dofFunction
compact_radius_dof(rr::Regression, T::Number, N::Integer, K::Integer)
compact_radius_dof(rr::CrossSectionalFactorModel, T::Number, N::Integer, K::Integer)

Degrees of freedom the fit behind a loadings block left in each idiosyncratic variance.

Algorithm

  1. On a Regression, return T - K - 1. The block comes from a per-asset time-series fit over K factors and an intercept, so each residual series spends K + 1 of its T observations.
  2. On a CrossSectionalFactorModel, return T * (N - K) / N. The block comes from a per-period fit across the cross-section, which spends K of the N assets each period rather than K of the T observations once, so the count is the fraction of each period that survives, over all T periods.

Neither count is read off the block, because no block records one. FactorPrior writes esigma as the column variances of the reconstruction error under whatever variance estimator it was given, and a Cross-Sectional Factor Prior writes the idiosyncratic covariance its own fit measured. So both counts are the count the fit spent, stated here, and a caller whose estimator spent a different number states it on the rule instead.

Arguments

  • rr: Fitted loadings block.
  • T: Sample size, the effective one when the prior carries observation weights.
  • N: Number of assets.
  • K: Number of factors the fit spent.

Returns

  • dof::Number: Degrees of freedom, before the rule refuses a non-positive count.

Related

source
PortfolioOptimisers.compact_radius_sample_sizeFunction
compact_radius_sample_size(pr::AbstractPriorResult) -> Any

Effective sample size behind a prior result, Kish's when the result carries observation weights.

A weighted estimate carries the information of sum(w)^2 / sum(w .^ 2) equally weighted observations rather than of size(pr.X, 1) rows, and a rule that prices estimation error reads the former. This is the reading ConcentrationRadius already takes for the same reason, and it is effective_sample_size on the result's own weights, so a Scenario Cap's stated count is read here too.

Arguments

  • pr: Prior result.

Returns

  • T::Number: Kish's effective sample size when pr.w is set, the count pr.ens states otherwise, and the raw row count when neither is set.

Related

source
PortfolioOptimisers.compact_reference_weightsFunction
compact_reference_weights(::Nothing, N::Integer, ::Any, ::Type{E}) where {E}
compact_reference_weights(w0::VecNum, N::Integer, ::Any, ::Type)
compact_reference_weights(w0::NonFiniteAllocationOptimisationEstimator, N::Integer,
                          rd::ReturnsResult, ::Type)

Reference portfolio a VarianceFraction sizes its penalty at.

Algorithm

  1. On nothing, return the equal-weight portfolio over the N assets the span covers.
  2. On a vector, return it, after checking it carries one entry per asset.
  3. On an optimiser, run optimise over rd and return the weights it produced. The optimiser carries its own solver, so nothing is threaded into the uncertainty-set fit. A set fitted with no returns data beside it refuses, because an optimiser has nothing to run on.

Arguments

  • w0: The w0 field of the rule.
  • N: Number of assets the span covers.
  • rd: Returns data the set was fitted beside, or nothing.
  • E: Element type of the geometry, which the equal-weight vector is built in.

Validation

  • A stated vector carries N entries, else a DimensionMismatch.
  • An optimiser meets a ReturnsResult, else an IsNothingError.
  • The optimiser's weights carry N entries, else a DimensionMismatch.

Returns

  • w0::VecNum: Reference portfolio of length N.

Related

source