Skip to content
5

Base Moments

PortfolioOptimisers.Full Type
julia
struct Full <: AbstractMomentAlgorithm end

Full is used to indicate that all available data points are included in the moment estimation process.

Related

source
PortfolioOptimisers.Semi Type
julia
struct Semi <: AbstractMomentAlgorithm end

Semi is used for semi-moment estimators, where only observations below the mean (i.e., negative deviations) are considered.

Related

source
PortfolioOptimisers.AbstractExpectedReturnsEstimator Type
julia
abstract type AbstractExpectedReturnsEstimator <: AbstractEstimator end

Abstract supertype for all expected returns estimator types in PortfolioOptimisers.jl.

All concrete types that implement expected returns estimation (e.g., sample mean, Bayesian estimators) should subtype AbstractExpectedReturnsEstimator. This enables a consistent interface for expected returns estimation routines throughout the package.

Related

source
PortfolioOptimisers.AbstractExpectedReturnsAlgorithm Type
julia
abstract type AbstractExpectedReturnsAlgorithm <: AbstractAlgorithm end

Abstract supertype for all expected returns algorithm types in PortfolioOptimisers.jl.

All concrete types that implement a specific algorithm for expected returns estimation (e.g., shrinkage, robust mean) should subtype AbstractExpectedReturnsAlgorithm. This allows for flexible extension and dispatch of expected returns estimation routines.

Related

source
PortfolioOptimisers.AbstractMomentAlgorithm Type
julia
abstract type AbstractMomentAlgorithm <: AbstractAlgorithm end

Abstract supertype for all moment algorithm types in PortfolioOptimisers.jl.

All concrete types that implement a specific algorithm for moment estimation (e.g., full, semi) should subtype AbstractMomentAlgorithm. This allows for flexible extension and dispatch of moment estimation routines.

Related

source
PortfolioOptimisers.AbstractCovarianceEstimator Type
julia
abstract type AbstractCovarianceEstimator <: StatsBase.CovarianceEstimator end

Abstract supertype for all covariance estimator types in PortfolioOptimisers.jl.

All concrete types that implement covariance estimation (e.g., sample covariance, shrinkage estimators) should subtype AbstractCovarianceEstimator. This enables a consistent interface for covariance estimation routines throughout the package.

Related

source
PortfolioOptimisers.AbstractVarianceEstimator Type
julia
abstract type AbstractVarianceEstimator <: AbstractCovarianceEstimator end

Abstract supertype for all variance estimator types in PortfolioOptimisers.jl.

All concrete types that implement variance estimation (e.g., sample variance, robust variance estimators) should subtype AbstractVarianceEstimator. This enables a consistent interface for variance estimation routines and allows for flexible extension and dispatch within the package.

Related

source
PortfolioOptimisers.robust_cov Function
julia
robust_cov(ce::StatsBase.CovarianceEstimator, X::AbstractMatrix, [w::AbstractWeights];
           dims::Int = 1, mean = nothing, kwargs...)

Compute the covariance matrix robustly using the specified covariance estimator ce, data matrix X, and optional weights vector w.

This function attempts to compute the weighted covariance matrix using the provided estimator and keyword arguments. If an error occurs (e.g., due to unsupported keyword arguments), it retries with a reduced set of arguments for compatibility. This ensures robust weighted covariance estimation across different estimator types and StatsBase versions.

Arguments

  • ce: Covariance estimator to use.

  • X: Data matrix.

  • w: Optional weights for each observation.

  • dims: Dimension along which to compute the covariance.

  • mean: Optional mean array to use for centering.

  • kwargs...: Additional keyword arguments passed to cov.

Returns

  • sigma::AbstractMatrix{<:Real}: Covariance matrix.

Related

source
PortfolioOptimisers.robust_cor Function
julia
robust_cor(ce::StatsBase.CovarianceEstimator, X::AbstractMatrix, [w::AbstractWeights];
           dims::Int = 1, mean = nothing, kwargs...)

Compute the correlation matrix robustly using the specified covariance estimator ce, data matrix X, and optional weights vector w.

This function attempts to compute the weighted correlation matrix using the provided estimator and keyword arguments. If an error occurs, it falls back to computing the weighted covariance matrix and then converts it to a correlation matrix. This ensures robust weighted correlation estimation across different estimator types and StatsBase versions.

Arguments

  • ce: Covariance estimator to use.

  • X: Data matrix.

  • w: Optional weights for each observation.

  • dims: Dimension along which to compute the correlation.

  • mean: Optional mean array to use for centering.

  • kwargs...: Additional keyword arguments passed to cor.

Returns

  • rho::AbstractMatrix{<:Real}: Correlation matrix.

Related

source