Skip to content
13

Non-Optimisation Risk Measures

PortfolioOptimisers.MeanReturn Type
julia
struct MeanReturn{__T_w, __T_flag} <: NonOptimisationRiskMeasure

Represents a simple mean return measure for use in non-optimisation contexts.

MeanReturn computes the arithmetic (or geometric, when flag = true) mean of portfolio returns. It is used as the numerator in risk-adjusted performance ratios such as MeanReturnRiskRatio.

Mathematical Definition

For flag = false (arithmetic mean):

x¯=1Tt=1Txt.

For flag = true (log-return mean):

x¯log=1Tt=1Tlog(1+xt).

For observation-weighted samples, the weighted mean is used instead.

Fields

  • w: Optional observation weights.

  • flag: If true, log-transforms returns before averaging.

Constructors

julia
MeanReturn(;
    w::Option{<:ObsWeights} = nothing,
    flag::Bool = false
) -> MeanReturn

Keywords correspond to the struct's fields.

Validation

  • If w is not nothing: !isempty(w).

Functor

julia
(r::MeanReturn)(x::VecNum)

Computes the mean return of a portfolio returns vector x.

Arguments

  • x::VecNum: Portfolio returns vector.

Examples

julia
julia> MeanReturn()
MeanReturn
     w ┼ nothing
  flag ┴ Bool: false

Related

source
PortfolioOptimisers.MeanReturnRiskRatio Type
julia
struct MeanReturnRiskRatio{__T_rt, __T_rk, __T_rf} <: NonOptimisationRiskMeasure

Represents a mean return to risk ratio measure.

MeanReturnRiskRatio computes the ratio of the mean portfolio return (minus a risk-free rate) to a risk measure, used for performance analysis and comparison. It generalises the Sharpe ratio by allowing any risk measure in the denominator.

Mathematical Definition

MRRR(x)=x¯rfρ(x),

where x¯ is the mean return (computed by rt), rf is the risk-free rate, and ρ is any base risk measure (computed by rk).

Fields

  • rt: Mean return estimator.

  • rk: Risk measure for the denominator.

  • rf: Risk-free rate.

Constructors

julia
MeanReturnRiskRatio(;
    rt::MeanReturn = MeanReturn(),
    rk::AbstractBaseRiskMeasure = ConditionalValueatRisk(),
    rf::Number = 0.0
) -> MeanReturnRiskRatio

Keywords correspond to the struct's fields.

Related

source
PortfolioOptimisers.ThirdCentralMoment Type
julia
struct ThirdCentralMoment{__T_w, __T_mu} <: NonOptimisationRiskMeasure

Represents the Third Central Moment risk measure.

ThirdCentralMoment computes the third central moment of portfolio returns about a specified centre. It is used as a measure of the asymmetry (skewness) of the return distribution in higher-order portfolio optimisation.

Mathematical Definition

Let μ be the specified centre and δt=xtμ the centred deviations. The third central moment is:

m3(x)=1Tt=1Tδt3.

For observation-weighted samples, the weighted mean is used.

Fields

  • w: Optional observation weights.

  • mu: Centre (centering value, vector, or VecScalar).

Constructors

julia
ThirdCentralMoment(;
    w::Option{<:ObsWeights} = nothing,
    mu::Option{<:Num_VecNum_VecScalar} = nothing
) -> ThirdCentralMoment

Keywords correspond to the struct's fields.

Validation

  • If mu is a VecNum: !isempty(mu).

  • If w is not nothing: !isempty(w).

Functor

julia
(r::ThirdCentralMoment)(w::VecNum, X::MatNum, fees = nothing)

Computes the third central moment of the portfolio returns.

Arguments

  • w::VecNum: Portfolio weights vector.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Examples

julia
julia> ThirdCentralMoment()
ThirdCentralMoment
   w ┼ nothing
  mu ┴ nothing

Related

source
PortfolioOptimisers.Skewness Type
julia
struct Skewness{__T_ve, __T_w, __T_mu} <: NonOptimisationRiskMeasure

Represents the standardised Skewness risk measure.

Skewness computes the third standardised central moment (skewness) of portfolio returns. Negative skewness indicates a return distribution with a heavier left tail.

Mathematical Definition

Let μ be the specified centre, δt=xtμ, and σ the standard deviation of returns. The skewness is:

Skew(x)=1Tσ3t=1Tδt3.

Fields

  • ve: Variance estimator for computing σ.

  • w: Optional observation weights.

  • mu: Centre (centering value, vector, or VecScalar).

Constructors

julia
Skewness(;
    ve::AbstractVarianceEstimator = SimpleVariance(),
    w::Option{<:ObsWeights} = nothing,
    mu::Option{<:Num_VecNum_VecScalar} = nothing
) -> Skewness

Keywords correspond to the struct's fields.

Validation

  • If mu is a VecNum: !isempty(mu).

  • If w is not nothing: !isempty(w).

Functor

julia
(r::Skewness)(w::VecNum, X::MatNum, fees = nothing)

Computes the skewness of the portfolio returns.

Arguments

  • w::VecNum: Portfolio weights vector.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Examples

julia
julia> Skewness()
Skewness
  ve ┼ SimpleVariance
     │          me ┼ SimpleExpectedReturns
     │             │   w ┴ nothing
     │           w ┼ nothing
     │   corrected ┴ Bool: true
   w ┼ nothing
  mu ┴ nothing

Related

source
PortfolioOptimisers.TCM_Sk Type
julia
const TCM_Sk{T1, T2} = Union{...}

Parameterised union of ThirdCentralMoment and Skewness sharing the same observation-weight (T1) and target-mean (T2) type parameters.

Used for unified dispatch on moment-target calculation methods.

Related

source