Moment Risk Measures
PortfolioOptimisers.FirstLowerMoment Type
struct FirstLowerMoment <: UnstandardisedLowOrderMomentMeasureAlgorithmRepresents the first lower moment risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using the first lower moment, which is the negative mean of the deviations of the returns series below a target value.
Related
sourcePortfolioOptimisers.MeanAbsoluteDeviation Type
struct MeanAbsoluteDeviation <: UnstandardisedLowOrderMomentMeasureAlgorithmRepresents the mean absolute deviation risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk as the mean of the absolute deviations of the returns series from a target value.
Related
sourcePortfolioOptimisers.SecondMoment Type
struct SecondMoment{__T_ve, __T_alg1, __T_alg2} <: LowOrderMomentMeasureAlgorithmRepresents a second moment (variance or standard deviation) risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using the second central (full) or lower (semi) moment of the return distribution, supporting both full and semi (downside) formulations. The specific formulation is determined by the alg1 and alg2 fields, enabling flexible representation of variance, semi-variance, standard deviation, or semi-standard deviation.
Fields
ve: Variance estimator.alg1: First algorithm variant.alg2: Second algorithm variant.
Constructors
SecondMoment(;
ve::AbstractVarianceEstimator = SimpleVariance(; me = nothing),
alg1::AbstractMomentAlgorithm = Full(),
alg2::SecondMomentFormulation = SquaredSOCRiskExpr(),
) -> SecondMomentKeywords correspond to the struct's fields.
Examples
julia> SecondMoment()
SecondMoment
ve ┼ SimpleVariance
│ me ┼ nothing
│ w ┼ nothing
│ corrected ┴ Bool: true
alg1 ┼ Full()
alg2 ┴ SquaredSOCRiskExpr()Related
PortfolioOptimisers.factory Method
factory(
alg::SecondMoment,
w::Union{DynamicAbstractWeights, AbstractWeights}
) -> SecondMoment{<:AbstractVarianceEstimator, <:AbstractMomentAlgorithm, <:SecondMomentFormulation}Return a new SecondMoment with observation weights w applied to the underlying variance estimator.
Related
sourcePortfolioOptimisers.EvenMoment Type
struct EvenMoment{__T_p, __T_ddof, __T_alg} <: UnstandardisedLowOrderMomentMeasureAlgorithmRepresents an even-order moment risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using the
Fields
p: Power or order parameter.ddof: Degrees-of-freedom correction.alg: Moment algorithm.
Constructors
EvenMoment(;
p::Integer = 2,
ddof::Integer = 0,
alg::AbstractMomentAlgorithm = Full(),
) -> EvenMomentKeywords correspond to the struct's fields.
Validation
p >= 2.ddof >= 0andisfinite(ddof).
Examples
julia> EvenMoment()
EvenMoment
p ┼ Int64: 2
ddof ┼ Int64: 0
alg ┴ Full()Related
sourcePortfolioOptimisers.LowOrderMoment Type
struct LowOrderMoment{__T_settings, __T_w, __T_mu, __T_alg} <: RiskMeasureRepresents a low-order moment risk measure in PortfolioOptimisers.jl.
Computes portfolio risk using a low-order moment algorithm (such as first lower moment, mean absolute deviation, or second moment), optionally with custom weights and target values. This type is used for risk measures based on mean, variance, or related statistics.
Fields
settings: Risk measure settings.w: Optional portfolio weights.mu: Optional mean for centering.alg: Moment algorithm.
Constructors
LowOrderMoment(;
settings::RiskMeasureSettings = RiskMeasureSettings(),
w::Option{<:ObsWeights} = nothing,
mu::Option{<:Num_VecNum_VecScalar} = nothing,
alg::LowOrderMomentMeasureAlgorithm = FirstLowerMoment(),
) -> LowOrderMomentKeywords correspond to the struct's fields.
Validation
If
muis notnothing:::Number:isfinite(mu).::AbstractVector:!isempty(mu)andall(isfinite, mu).
If
wis notnothing,!isempty(w).
Mathematical definition
Depending on the alg field, the risk measure is formulated using JuMP as follows:
FirstLowerMoment
The first lower moment is computed as:
Where:
: T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Element-wise function application.
As an optimisation problem, it can be formulated as:
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations below the target.: T × Nreturn matrix.: Expected value operator, supports weighted averages.
MeanAbsoluteDeviation
The mean absolute deviation is computed as:
Where:
: T × 1vector of portfolio returns.: Expected value operator, supports weighted averages.
As an optimisation problem, it can be formulated as:
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations below the target.: T × Nreturn matrix.: Expected value operator, supports weighted averages.
SecondMoment
Depending on the alg1 field the risk measure can either compute the second central moment or second lower moment.
Info
Regardless of the formulation used, an auxiliary variable representing the square root of the central/lower moment is needed in order to constrain the risk or maximise the risk-adjusted return ratio. This is because quadratic constraints are not strictly convex, and the transformation needed to maximise the risk-adjusted return ratio requires affine variables in the numerator and denominator.
Both central and lower moments can be formulated as quadratic moments (variance or semi-variance) or their square roots (standard deviation or semi-standard deviation). Regardless of whether they are central or lower moments, they can be formulated in a variety of ways.
Depending on the alg2 field, it can represent the variance (using different formulations in JuMP) or standard deviation.
The (semi-)variance formulations are:
It is computed as:
Where:
: T × 1vector of portfolio returns.: Expected value operator, supports weighted averages.
The (semi-)standard deviation formulation is:
It is computed as:
Where:
: T × 1vector of portfolio returns.: Expected value operator, supports weighted averages.
SquaredSOCRiskExpr
Represents the (semi-)variance using the square of a second order cone constrained variable.
The variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Standard deviation of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Second order cone. : Element-wise (Hadamard) product.
The semi-variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Standard deviation of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Second order cone. : Element-wise (Hadamard) product.
RSOCRiskExpr
Represents the (semi-)variance using a sum of squares formulation via a rotated second order cone.
The variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Variance of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Rotated second order cone. : Element-wise (Hadamard) product.
The semi-variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Variance of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Rotated second order cone. : Element-wise (Hadamard) product.
QuadRiskExpr
Represents the (semi-)variance using the deviations vector dotted with itself.
The variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Element-wise (Hadamard) product.
The semi-variance is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: Minimum acceptable return. : T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Element-wise (Hadamard) product.
SOCRiskExpr
Represents the (semi-)standard deviation using a second order cone constrained variable.
The standard deviation is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Standard deviation of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Second order cone. : Element-wise (Hadamard) product.
The semi-standard deviation is formulated as.
Where:
: N × 1asset weights vector.: T × 1vector of auxiliary decision variables representing deviations from the target.: Standard deviation of the portfolio returns. : T × 1vector of scaled deviations according to observation weights.: T × Nreturn matrix.: Minimum acceptable return. : T × 1vector of observation weights.: Observation weights scaling factor, it is a function of the type of observation weights. : Element-wise (Hadamard) product. : Second order cone.
EvenMoment
EvenMoment computes the EvenMoment is not a low-order moment in the classical sense. However, because the exponent is always even, the moment can be expressed as an iterated power of squared deviations, admitting an exact reformulation using power cone constraints. This makes the optimisation problem affine and solvable by standard conic solvers.
The full (central) even moment is computed as:
The semi (lower) even moment is computed as:
Where:
: T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Effective sample size after degrees-of-freedom correction. : Order parameter; the moment order is . : Element-wise function application.
As an optimisation problem, the full even moment is formulated using a chain of power cone constraints:
The semi even moment is formulated as:
Where:
: N × 1asset weights vector.: Even-moment risk variable. : T × 1auxiliary variable vector.: T × 1auxiliary variable vector.: T × 1lower-deviation auxiliary variables, capturing returns below the target.: Effective sample size. : Budget-scaling / homogenisation variable. : Order parameter; the moment order is . : T × Nreturn matrix.: Portfolio return at time . : Target return. : Power cone .
Functor
(r::LowOrderMoment)(w::VecNum, X::MatNum;
fees::Option{<:Fees} = nothing)Computes the the low order moment risk measure as defined in r using portfolio weights w, return matrix X, and optional fees fees.
Details
r.algdefines what low-order moment to compute.The values of
r.muandr.ware optionally used to compute the moment target viacalc_moment_target, which is used incalc_deviations_vecto compute the deviation vector.
Examples
julia> LowOrderMoment()
LowOrderMoment
settings ┼ RiskMeasureSettings
│ scale ┼ Float64: 1.0
│ ub ┼ nothing
│ rke ┴ Bool: true
w ┼ nothing
mu ┼ nothing
alg ┴ FirstLowerMoment()Related
PortfolioOptimisers.ThirdLowerMoment Type
struct ThirdLowerMoment <: UnstandardisedHighOrderMomentMeasureAlgorithmRepresents the unstandardised semi-skewness risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using the third lower moment (unstandardised semi-skewness), which quantifies downside asymmetry by considering only the cubed deviations below a target value. This algorithm is unstandardised and operates directly on the return distribution.
Related
sourcePortfolioOptimisers.FourthMoment Type
struct FourthMoment{__T_alg} <: UnstandardisedHighOrderMomentMeasureAlgorithmRepresents the unstandardised fourth moment (kurtosis or semi-kurtosis) risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using the fourth central (full) or lower (semi) moment of the return distribution, depending on the provided moment algorithm. This algorithm quantifies the "tailedness" of the return distribution without normalising by the variance.
Fields
alg: Moment algorithm.
Constructors
FourthMoment(;
alg::AbstractMomentAlgorithm = Full(),
) -> FourthMomentKeywords correspond to the struct's fields.
Examples
julia> FourthMoment()
FourthMoment
alg ┴ Full()Related
sourcePortfolioOptimisers.StandardisedHighOrderMoment Type
struct StandardisedHighOrderMoment{__T_ve, __T_alg} <: HighOrderMomentMeasureAlgorithmRepresents a standardised high-order moment risk measure algorithm in PortfolioOptimisers.jl.
Computes portfolio risk using a high-order moment algorithm (such as semi-skewness or semi-kurtosis), standardised by a variance estimator.
Fields
ve: Variance estimator.alg: Moment algorithm.
Constructors
StandardisedHighOrderMoment(;
ve::AbstractVarianceEstimator = SimpleVariance(; me = nothing),
alg::UnstandardisedHighOrderMomentMeasureAlgorithm = ThirdLowerMoment(),
) -> StandardisedHighOrderMomentKeywords correspond to the struct's fields.
Examples
julia> StandardisedHighOrderMoment()
StandardisedHighOrderMoment
ve ┼ SimpleVariance
│ me ┼ nothing
│ w ┼ nothing
│ corrected ┴ Bool: true
alg ┴ ThirdLowerMoment()Related
PortfolioOptimisers.factory Method
factory(
alg::StandardisedHighOrderMoment,
w::Union{DynamicAbstractWeights, AbstractWeights}
) -> StandardisedHighOrderMoment{<:AbstractVarianceEstimator, <:UnstandardisedHighOrderMomentMeasureAlgorithm}Return a new StandardisedHighOrderMoment with observation weights w applied to the underlying variance estimator.
Related
sourcePortfolioOptimisers.HighOrderMoment Type
struct HighOrderMoment{__T_settings, __T_w, __T_mu, __T_alg} <: HierarchicalRiskMeasureRepresents a high-order moment risk measure in PortfolioOptimisers.jl.
Computes portfolio risk using a high-order moment algorithm (such as semi-skewness, semi-kurtosis, or kurtosis), optionally with custom weights and target values. This type is used for risk measures based on third or fourth moments of the return distribution.
Fields
settings: Risk measure settings.w: Optional portfolio weights.mu: Optional mean for centering.alg: Moment algorithm.
Constructors
HighOrderMoment(;
settings::RiskMeasureSettings = RiskMeasureSettings(),
w::Option{<:ObsWeights} = nothing,
mu::Option{<:Num_VecNum_VecScalar} = nothing,
alg::HighOrderMomentMeasureAlgorithm = ThirdLowerMoment(),
) -> HighOrderMomentKeywords correspond to the struct's fields.
Validation
If
muis notnothing:::Number:isfinite(mu).::AbstractVector:!isempty(mu)andall(isfinite, mu).
If
wis notnothing,!isempty(w).
Mathematical definition
Depending on the alg field, the risk measure is can compute the third lower moment, fourth lower (semi) moment, or fourth central (full) moment. Each can be standardised or unstandardised.
The unstandardised formulations are:
The standardised formulations are:
StandardisedHighOrderMoment, which uses a variance estimator and an unstandardised high-order moment algorithm.
Unstandardised Moments
All unstandardised central moments have the following formula.
Where:
: -th central moment. : T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Moment order.
All unstandardised lower moments have the following formula.
Where:
: -th lower moment. : T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Element-wise function application. : Moment order.
Standardised Moments
All standardised central moments have the following formula.
Where:
: -th standardised central moment. : T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Moment order.
All standardised lower moments have the following formula.
Where:
: -th standardised lower moment. : T × 1vector of portfolio returns.: Expected value operator, supports weighted averages. : Element-wise function application. : Moment order.
Functor
(r::HighOrderMoment)(w::VecNum, X::MatNum;
fees::Option{<:Fees} = nothing)Computes the the high order moment risk measure as defined in r using portfolio weights w, return matrix X, and optional fees fees.
Details
r.algdefines what low-order moment to compute.The values of
r.muandr.ware optionally used to compute the moment target viacalc_moment_target, which is used incalc_deviations_vecto compute the deviation vector.
Examples
julia> HighOrderMoment()
HighOrderMoment
settings ┼ RiskMeasureSettings
│ scale ┼ Float64: 1.0
│ ub ┼ nothing
│ rke ┴ Bool: true
w ┼ nothing
mu ┼ nothing
alg ┴ ThirdLowerMoment()Related
PortfolioOptimisers.MomentMeasureAlgorithm Type
abstract type MomentMeasureAlgorithm <: AbstractAlgorithmAbstract supertype for all moment-based risk measure algorithms in PortfolioOptimisers.jl.
Defines the interface for algorithms that compute portfolio risk using statistical moments (e.g., mean, variance, skewness, kurtosis) of the return distribution. All concrete moment risk measure algorithms should subtype MomentMeasureAlgorithm to ensure consistency and composability within the risk measure framework.
Related Types
sourcePortfolioOptimisers.factory Method
factory(
alg::MomentMeasureAlgorithm,
args...;
kwargs...
) -> SecondMoment{<:AbstractVarianceEstimator, <:AbstractMomentAlgorithm, <:SecondMomentFormulation}Return the moment measure algorithm alg unchanged.
Identity pass-through used when a moment measure algorithm is provided in a context that calls factory.
Related
sourcePortfolioOptimisers.LowOrderMomentMeasureAlgorithm Type
abstract type LowOrderMomentMeasureAlgorithm <: MomentMeasureAlgorithmAbstract supertype for all low-order moment-based risk measure algorithms in PortfolioOptimisers.jl.
Defines the interface for algorithms that compute portfolio risk using low-order statistical moments (e.g., mean, variance, mean absolute deviation) of the return distribution. All concrete low-order moment risk measure algorithms should subtype LowOrderMomentMeasureAlgorithm to ensure consistency and composability within the risk measure framework.
Related Types
sourcePortfolioOptimisers.UnstandardisedLowOrderMomentMeasureAlgorithm Type
abstract type UnstandardisedLowOrderMomentMeasureAlgorithm <: LowOrderMomentMeasureAlgorithmAbstract supertype for low-order moment risk measure algorithms that are not standardised by the variance in PortfolioOptimisers.jl.
Defines the interface for algorithms that compute portfolio risk using low-order statistical moments without normalising by the variance. All concrete unstandardised low-order moment risk measure algorithms should subtype UnstandardisedLowOrderMomentMeasureAlgorithm to ensure consistency and composability within the risk measure framework.
Related Types
sourcePortfolioOptimisers.HighOrderMomentMeasureAlgorithm Type
abstract type HighOrderMomentMeasureAlgorithm <: MomentMeasureAlgorithmAbstract supertype for all high-order moment-based risk measure algorithms in PortfolioOptimisers.jl.
Defines the interface for algorithms that compute portfolio risk using high-order statistical moments (e.g., skewness, kurtosis) of the return distribution. All concrete high-order moment risk measure algorithms should subtype HighOrderMomentMeasureAlgorithm to ensure consistency and composability within the risk measure framework.
Related Types
sourcePortfolioOptimisers.UnstandardisedHighOrderMomentMeasureAlgorithm Type
abstract type UnstandardisedHighOrderMomentMeasureAlgorithm <: HighOrderMomentMeasureAlgorithmAbstract supertype for high-order moment risk measure algorithms that are not standardised by the variance in PortfolioOptimisers.jl.
Defines the interface for algorithms that compute portfolio risk using high-order statistical moments (such as skewness, kurtosis) without normalising by the variance. All concrete unstandardised high-order moment risk measure algorithms should subtype UnstandardisedHighOrderMomentMeasureAlgorithm to ensure consistency and composability within the risk measure framework.
Related Types
sourcePortfolioOptimisers.LoHiOrderMoment Type
const LoHiOrderMoment{T1, T2, T3, T4} = Union{...}Parameterised union of LowOrderMoment and HighOrderMoment sharing the same type parameters.
Used for unified dispatch on moment-target calculation methods.
Related
sourcePortfolioOptimisers.calc_moment_target Method
calc_moment_target(::LoHiOrderMoment{<:Any, Nothing, Nothing, <:Any},
::Any, x::VecNum)Compute the target value for moment calculations when neither a target value (mu) nor observation weights are provided in the risk measure.
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure with bothwandmufields set tonothing._: Unused argument (typically asset weights, ignored in this method).x: Returns vector.
Returns
tgt::eltype(x): The mean of the returns vector.
Related
sourcePortfolioOptimisers.calc_moment_target Method
calc_moment_target(r::LoHiOrderMoment{<:Any, <:StatsBase.AbstractWeights, Nothing, <:Any},
::Any, x::VecNum)Compute the target value for moment calculations when the risk measure provides an observation weights vector but no explicit target value (mu).
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure withwset to an observation weights vector andmuset tonothing._: Unused argument (typically asset weights, ignored in this method).x: Returns vector.
Returns
tgt::eltype(x): The weighted mean of the returns vector, using the observation weights fromr.w.
Related
sourcePortfolioOptimisers.calc_moment_target Method
calc_moment_target(r::LoHiOrderMoment{<:Any, <:Any, <:VecNum, <:Any},
w::VecNum, ::Any)Compute the target value for moment calculations when the risk measure provides an explicit expected returns vector (mu).
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure withmuset to an expected returns vector.w: Asset weights vector.::Any: Unused argument (typically the returns vector, ignored in this method).
Returns
tgt::eltype(w): The dot product of the asset weights and the expected returns vector.
Related
sourcePortfolioOptimisers.calc_moment_target Method
calc_moment_target(r::LoHiOrderMoment{<:Any, <:Any, <:VecScalar, <:Any},
w::VecNum, ::Any)Compute the target value for moment calculations when the risk measure provides a VecScalar as the expected returns (mu).
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure withmuset to aVecScalar(an object with fieldsvfor the expected returns vector andsfor a scalar offset).w: Asset weights vector.::Any: Unused argument (typically the returns vector, ignored in this method).
Returns
tgt::promote_type(eltype(w), eltype(r.mu.v), typeof(r.mu.s)): The sum of the dot product of the asset weights and the expected returns vector plus the scalar offset,LinearAlgebra.dot(w, r.mu.v) + r.mu.s.
Related
sourcePortfolioOptimisers.calc_moment_target Method
calc_moment_target(r::LoHiOrderMoment{<:Any, <:Any, <:Number, <:Any},
::Any, ::Any)Compute the target value for moment calculations when the risk measure provides a scalar value for the expected returns (mu).
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure withmuset to a scalar value.::Any: Unused argument (typically asset weights, ignored in this method).::Any: Unused argument (typically the returns vector, ignored in this method).
Returns
tgt::Number: The scalar value ofr.mu.
Related
sourcePortfolioOptimisers.calc_deviations_vec Function
calc_deviations_vec(r::LoHiOrderMoment, w::VecNum,
X::MatNum; fees::Option{<:Fees} = nothing)Compute the vector of deviations from the target value for moment-based risk measures.
Arguments
r: ALowOrderMomentorHighOrderMomentrisk measure specifying the moment calculation algorithm and target.w: Asset weights vector.X: Return matrix.fees: Optional fees object to adjust net returns.
Returns
val::AbstractVector: The vector of deviations between net portfolio returns and the computed moment target.
Details
Computes net portfolio returns using the provided weights, return matrix, and optional fees.
Computes the target value for the moment calculation using
calc_moment_target.Returns the element-wise difference between net returns and the target value.
Related
sourcePortfolioOptimisers.calc_deviations_vec Method
calc_deviations_vec(
r::Union{HighOrderMoment{T1, T2, T3, T4}, LowOrderMoment{T1, T2, T3, T4}} where {T1, T2, T3, T4},
x::AbstractVector{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}}
) -> AnyCompute the vector of deviations from the target value for a precomputed returns series.
Single-argument form of calc_deviations_vec used by the precomputed-returns functor r(x::VecNum) (ADR 0007).
Related
sourcePortfolioOptimisers.factory Method
factory(
r::LowOrderMoment,
pr::AbstractPriorResult,
args...;
kwargs...
) -> LowOrderMoment{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, _A, _B, <:LowOrderMomentMeasureAlgorithm} where {__T_scale, __T_ub, __T_rke, _A, _B}Create an instance of LowOrderMoment by selecting observation weights, expected returns, and algorithm from the risk-measure instance or falling back to the prior result.
Related
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(
r::LowOrderMoment,
i,
args...
) -> LowOrderMoment{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, _A, _B, <:LowOrderMomentMeasureAlgorithm} where {__T_scale, __T_ub, __T_rke, _A, _B}Return a view of LowOrderMoment r sliced to asset indices i.
Slices the expected returns mu for cluster-based optimisation.
Related
sourcePortfolioOptimisers.factory Method
factory(
r::HighOrderMoment,
pr::AbstractPriorResult,
args...;
kwargs...
) -> HighOrderMoment{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, _A, _B, <:HighOrderMomentMeasureAlgorithm} where {__T_scale, __T_ub, __T_rke, _A, _B}Create an instance of HighOrderMoment by selecting observation weights, expected returns, and algorithm from the risk-measure instance or falling back to the prior result.
Related
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(
r::HighOrderMoment,
i,
args...
) -> HighOrderMoment{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, _A, _B, <:HighOrderMomentMeasureAlgorithm} where {__T_scale, __T_ub, __T_rke, _A, _B}Return a view of HighOrderMoment r sliced to asset indices i.
Slices the expected returns mu for cluster-based optimisation.
Related
sourcePortfolioOptimisers.supports_precomputed_returns Method
supports_precomputed_returns(
r::Union{HighOrderMoment{T1, T2, T3, T4}, LowOrderMoment{T1, T2, T3, T4}} where {T1, T2, T3, T4}
) -> AnyReturn whether LoHiOrderMoment r supports precomputed-return evaluation.
Delegates to weight_independent_target on r.mu: true iff the target is Nothing, a Number, or a MedianCenteringFunction; false for per-asset targets.
Related
sourcePortfolioOptimisers._moment_risk Function
_moment_risk(r::LoHiOrderMoment, val::VecNum)
_moment_risk(r::Kurtosis, val::VecNum)
_moment_risk(r::Skewness, val::VecNum)
_moment_risk(r::MedianAbsoluteDeviation, val::VecNum)
_moment_risk(r::ThirdCentralMoment, val::VecNum)Shared post-deviation kernel for the moment-family risk measures. Given the vector of deviations val (net portfolio returns minus the measure's target, from calc_deviations_vec), compute the measure's scalar value. Dispatch selects the per-algorithm reduction (lower/full, the power, the standardisation, the formulation).
Both functor arities funnel through this kernel: r(w, X, fees) calls _moment_risk(r, calc_deviations_vec(r, w, X, fees)), and the single-argument precomputed-returns form r(x::VecNum) calls _moment_risk(r, calc_deviations_vec(r, x)), so the two share one definition of the math (ADR 0007).
Related
source