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} <: AbstractResultThe 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, ornothing.
factor: The standard error of the mean return contribution of each factor,NaNfor an observed factor, ornothing.
family: The standard error of the mean return contribution of each family, ornothing.
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
sysandfactorare bothnothing, or both stated. Otherwise, the constructor raises anArgumentError.familyisnothingwhenfactorisnothing. Otherwise, the constructor raises anArgumentError.
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
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