Standard deviation expected returns

PortfolioOptimisers.StandardDeviationExpectedReturnsType
struct StandardDeviationExpectedReturns{__T_ce} <: AbstractExpectedReturnsEstimator

Expected returns estimator that returns the asset standard deviations.

StandardDeviationExpectedReturns computes "expected returns" as the standard deviation of each asset, as estimated by the underlying covariance estimator. This can be useful in certain risk-based portfolio construction approaches where the expected return proxy is the asset's volatility.

Fields

  • ce: Covariance estimator.

Constructors

StandardDeviationExpectedReturns(;    ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance()) -> StandardDeviationExpectedReturns

Keywords correspond to the struct's fields.

Propagated parameters

When factory is called on this type, the following @fprop-tagged fields are automatically propagated:

  • ce: Recursively updated via factory.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Examples

julia> StandardDeviationExpectedReturns()StandardDeviationExpectedReturns  ce ┼ PortfolioOptimisersCovariance     │   ce ┼ Covariance     │      │    me ┼ SimpleExpectedReturns     │      │       │   w ┴ nothing     │      │    ce ┼ GeneralCovariance     │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)     │      │       │    w ┴ nothing     │      │   alg ┴ FullMoment()     │   mp ┼ MatrixProcessing     │      │     pdm ┼ Posdef     │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton     │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()     │      │      dn ┼ nothing     │      │      dt ┼ nothing     │      │     alg ┼ nothing     │      │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)

Related

source
Statistics.meanMethod
Statistics.mean(me::StandardDeviationExpectedReturns, X::MatNum;
                dims::Int = 1, kwargs...)

Compute expected returns as the standard deviation of each asset.

This method returns the standard deviation vector of X as estimated by the covariance estimator me.ce.

Mathematical definition

\[\begin{align} \hat{\mu}_j &= \hat{\sigma}_j = \sqrt{\hat{\mathbf{\Sigma}}_{jj}}\,. \end{align}\]

Where:

  • $\hat{\mu}_j$: Expected return proxy of asset $j$.
  • $\hat{\sigma}_j$: Standard deviation of asset $j$.
  • $\hat{\mathbf{\Sigma}}$: Covariance matrix that me.ce estimates.
  • $\hat{\mathbf{\Sigma}}_{jj}$: $j$-th diagonal element of $\hat{\mathbf{\Sigma}}$.

Arguments

  • me: Standard deviation expected returns estimator.
  • X: Data matrix of asset returns (observations × assets).
  • dims: Dimension along which to perform the computation.
  • kwargs...: Additional keyword arguments passed to the covariance estimator.

Validation

  • dims in (1, 2).

Returns

  • mu::Matrix{<:Number}: Standard deviation vector, shaped as (1, N) if dims == 1 or (N, 1) if dims == 2.

Details

  • The method reads the diagonal of the matrix that me.ce returns, not a formula of its own. Every choice inside me.ce therefore reaches the result: the moment algorithm, the observation weights, and the matrix processing.

Related

source
PortfolioOptimisers.VarianceExpectedReturnsType
struct VarianceExpectedReturns{__T_ce} <: AbstractExpectedReturnsEstimator

Expected returns estimator that returns the asset variances.

VarianceExpectedReturns computes "expected returns" as the variance of each asset, as estimated by the underlying covariance estimator. This can be useful in certain risk-based portfolio construction approaches where the expected return proxy is the asset's variance. Variance is the square of volatility (standard deviation).

Fields

  • ce: Covariance estimator.

Constructors

VarianceExpectedReturns(;    ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance()) -> VarianceExpectedReturns

Keywords correspond to the struct's fields.

Propagated parameters

When factory is called on this type, the following @fprop-tagged fields are automatically propagated:

  • ce: Recursively updated via factory.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Examples

julia> VarianceExpectedReturns()VarianceExpectedReturns  ce ┼ PortfolioOptimisersCovariance     │   ce ┼ Covariance     │      │    me ┼ SimpleExpectedReturns     │      │       │   w ┴ nothing     │      │    ce ┼ GeneralCovariance     │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)     │      │       │    w ┴ nothing     │      │   alg ┴ FullMoment()     │   mp ┼ MatrixProcessing     │      │     pdm ┼ Posdef     │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton     │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()     │      │      dn ┼ nothing     │      │      dt ┼ nothing     │      │     alg ┼ nothing     │      │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)

Related

source
PortfolioOptimisers.factoryMethod
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
                 <:AbstractResult}, args...; kwargs...) -> a
factory(a::AbstractVector{<:Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
                                  <:AbstractResult}}, args...; kwargs...) -> Vector

No-op factory function for constructing objects with a uniform interface.

Defining methods which dispatch on the first argument allows for a consistent factory interface across different types.

factory and port_opt_view are the two propagation mechanisms in this library. They are duals: factory threads runtime values (prior moments, observation weights, previous portfolio weights) down through a composed struct tree; port_opt_view threads an index selection (a subset of assets or observations) down through the same tree.

The vector method is the one forwarding contract for every vector-valued propagation field: it applies factory to each element and forwards args... and kwargs... unchanged, so a family that admits a vector of estimators, algorithms, or results needs no method of its own. A family that needs more than the forward, such as a concrete element type (concrete_typed_array_if_abstract), defines its own more specific method.

Algorithm

The scalar method:

  1. Return a unchanged, and drop args... and kwargs.... This method is the leaf of the recursion, and it is what makes an untagged type safe to call the verb on.

The vector method:

  1. For each element ai of a, call factory on ai, and forward args... and kwargs... unchanged.
  2. Collect the results into a new vector, in the order of a, and return it.

A @propagatable struct with at least one @fprop- or @wprop-tagged field carries a generated method that dominates the scalar method. That method rebuilds the struct with its keyword constructor, sending each @fprop field through factory_child and each @wprop field through _wprop.

Arguments

  • a: Indicates no object should be constructed, or a vector whose elements are rebuilt one by one.
  • args...: Arbitrary positional arguments (ignored by the scalar method, forwarded by the vector method).
  • kwargs...: Arbitrary keyword arguments (ignored by the scalar method, forwarded by the vector method).

Returns

  • a: The input unchanged.
  • v::Vector: The element-wise rebuilds, for the vector method.

Examples

julia> factory(nothing, 1, 2; x = 3)julia> factory(MeanValue())MeanValue  w ┴ nothing

Related

source
Statistics.meanMethod
Statistics.mean(me::VarianceExpectedReturns, X::MatNum;
                dims::Int = 1, kwargs...)

Compute expected returns as the variance of each asset.

This method returns the variance vector of X as estimated by the covariance estimator me.ce.

Mathematical definition

\[\begin{align} \hat{\mu}_j &= \hat{\sigma}_j^2 = \hat{\mathbf{\Sigma}}_{jj}\,. \end{align}\]

Where:

  • $\hat{\mu}_j$: Expected return proxy of asset $j$.
  • $\hat{\sigma}_j^2$: Variance of asset $j$.
  • $\hat{\mathbf{\Sigma}}$: Covariance matrix that me.ce estimates.
  • $\hat{\mathbf{\Sigma}}_{jj}$: $j$-th diagonal element of $\hat{\mathbf{\Sigma}}$.

Arguments

  • me: Variance expected returns estimator.
  • X: Data matrix of asset returns (observations × assets).
  • dims: Dimension along which to perform the computation.
  • kwargs...: Additional keyword arguments passed to the covariance estimator.

Validation

  • dims in (1, 2).

Returns

  • mu::Matrix{<:Number}: Variance vector, shaped as (1, N) if dims == 1 or (N, 1) if dims == 2.

Details

  • The method reads the diagonal of the matrix that me.ce returns, not a formula of its own. Every choice inside me.ce therefore reaches the result: the moment algorithm, the observation weights, and the matrix processing.

Related

source