Factor attribution realised

The verb of this page is a method that a new AbstractUnknownEntryRule implements, and the type of this page is the answer that its method of attribution_leverage_errors builds. The private page documents the other names of this topic.

PortfolioOptimisers.AttributionErrorsResult — Type
struct AttributionErrorsResult{__T_sys, __T_factor, __T_family} <: AbstractResult

The standard errors of the mean return contributions of a realised attribution: the systematic error, the error of each factor and the error of each family.

attribution_standard_errors returns it, through attribution_error_pass and attribution_leverage_errors. A rule for an unknown entry builds it in its own method of attribution_leverage_errors, as the # Interfaces section of AbstractUnknownEntryRule states. So the type is the contract of the interface, and its constructor checks that the three answers agree on what they state. An attribution that was not asked for its standard errors holds AttributionErrorsResult(), the answer with nothing in each field. A caller reads the fields by name, as ses.sys or (; sys, factor, family) = ses.

Fields

  • sys: The standard error of the systematic mean return contribution, or nothing.
  • factor: The standard error of the mean return contribution of each factor, NaN for an observed factor, or nothing.
  • family: The standard error of the mean return contribution of each family, or nothing.

Constructors

AttributionErrorsResult(sys::Option{<:Number}, factor::Option{<:VecNum},                        family::Option{<:VecNum})AttributionErrorsResult(; sys::Option{<:Number} = nothing,                        factor::Option{<:VecNum} = nothing,                        family::Option{<:VecNum} = nothing)

The positional constructor checks the values. The keyword constructor takes each field by name, with the default nothing, and calls it.

Validation

  • sys and factor are both nothing, or both stated. Otherwise, the constructor raises an ArgumentError.
  • family is nothing when factor is nothing. Otherwise, the constructor raises an ArgumentError.

Examples

julia> ses = PortfolioOptimisers.AttributionErrorsResult(; sys = 0.5, factor = [0.1, 0.2]);julia> (ses.sys, ses.factor, ses.family)(0.5, [0.1, 0.2], nothing)julia> isnothing(PortfolioOptimisers.AttributionErrorsResult().sys)truejulia> PortfolioOptimisers.AttributionErrorsResult(0.5, nothing, nothing)ERROR: ArgumentError: the systematic standard error and the standard error of each factor must both be stated or both be nothing[...]

Related

source
PortfolioOptimisers.attribution_standalone_pairs — Function
attribution_standalone_pairs(rule::EntrywiseUnknown, act::AbstractVector{Bool})
attribution_standalone_pairs(rule::ZeroUnknown, act::AbstractVector{Bool})

Return the observations the realised standalone moments of one asset read.

EntrywiseUnknown reads the active pairs of the asset alone, because an asset has no return at an inactive pair. ZeroUnknown reads every observation. An inactive pair is zero in the exposures and the idiosyncratic returns, so its model return reads as zero.

Arguments

  • rule: The rule for an unknown entry.
  • act: Whether each aligned pair of the asset is active.

Returns

  • a::AbstractVector{Bool}: The observations the moments read.

Related

source