Bootstrap Uncertainty Sets
PortfolioOptimisers.StationaryBootstrap Type
struct StationaryBootstrap <: ARCHBootstrapSetBootstrap algorithm for constructing uncertainty sets using a stationary bootstrap in time series data.
Related
sourcePortfolioOptimisers.CircularBootstrap Type
struct CircularBootstrap <: ARCHBootstrapSetBootstrap algorithm for constructing uncertainty sets using a circular bootstrap in time series data.
Related
sourcePortfolioOptimisers.MovingBootstrap Type
struct MovingBootstrap <: ARCHBootstrapSetBootstrap algorithm for constructing uncertainty sets using a moving bootstrap in time series data.
Related
sourcePortfolioOptimisers.ARCHUncertaintySet Type
struct ARCHUncertaintySet{__T_pe, __T_alg, __T_n_sim, __T_block_size, __T_q, __T_seed, __T_bootstrap, __T_kwargs} <: BootstrapUncertaintySetEstimatorEstimator for box or ellipsoidal uncertainty sets using bootstrap methods for time series data in portfolio optimisation.
Fields
pe: Prior estimator.alg: Uncertainty set algorithm.n_sim: Number of simulation samples.block_size: Block size for bootstrap sampling.q: Quantile parameter for uncertainty set computation.seed: Seed for the random number generator.bootstrap: Bootstrap algorithm.kwargs: Additional keyword arguments.
Constructors
ARCHUncertaintySet(;
pe::AbstractLowOrderPriorEstimator = EmpiricalPrior(),
alg::AbstractUncertaintySetAlgorithm = BoxUncertaintySetAlgorithm(),
n_sim::Integer = 3_000,
block_size::Integer = 3,
q::Number = 0.05,
seed::Option{<:Integer} = nothing,
bootstrap::ARCHBootstrapSet = StationaryBootstrap(),
kwargs::NamedTuple = (;),
) -> ARCHUncertaintySetKeywords correspond to the struct's fields.
Validation
n_sim > 0.block_size > 0.0 < q < 1.
Examples
julia> ARCHUncertaintySet()
ARCHUncertaintySet
pe ┼ EmpiricalPrior
│ ce ┼ PortfolioOptimisersCovariance
│ │ ce ┼ Covariance
│ │ │ me ┼ SimpleExpectedReturns
│ │ │ │ w ┴ nothing
│ │ │ ce ┼ GeneralCovariance
│ │ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ │ w ┴ nothing
│ │ │ alg ┴ Full()
│ │ 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)
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ horizon ┴ nothing
alg ┼ BoxUncertaintySetAlgorithm()
n_sim ┼ Int64: 3000
block_size ┼ Int64: 3
q ┼ Float64: 0.05
seed ┼ nothing
bootstrap ┼ StationaryBootstrap()
kwargs ┴ @NamedTuple{}: NamedTuple()Related
PortfolioOptimisers.ucs Function
ucs(ue::ARCHUncertaintySet{<:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs box uncertainty sets for expected returns and covariance statistics using bootstrap resampling for time series data.
Mathematical definition
Generate
Where:
, : Lower/upper bounds for expected return of asset . , : Lower/upper covariance bounds. , : Quantile functions at level . : Bootstrap mean for asset in sample . : Bootstrap covariance element in sample . : Significance level.
Arguments
ue: ARCH uncertainty set estimator.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set.sigma_ucs::BoxUncertaintySet: Covariance uncertainty set.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns and covariance using the specified bootstrap algorithm.
Computes lower and upper bounds for expected returns and covariance using quantiles of bootstrapped samples.
Returns both sets as a tuple.
Related
PortfolioOptimisers.ucs Function
ucs(ue::ARCHUncertaintySet{<:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs ellipsoidal uncertainty sets for expected returns and covariance statistics using bootstrap resampling for time series data.
Mathematical definition
Compute bootstrap deviations
Then form ellipsoidal sets:
Where:
: Empirical covariance of bootstrap mean deviations. : Empirical covariance of bootstrap covariance deviations (vectorised). , : Estimated mean and covariance. , : Bootstrap deviations for mean and covariance. : Ellipsoidal uncertainty set for expected returns. : Ellipsoidal uncertainty set for covariance. , : Empirically fitted scaling parameters.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipsoidal algorithm, simulation parameters, block size, quantile, seed, and bootstrap type.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::EllipsoidalUncertaintySet: Ellipsoidal uncertainty set for expected returns.sigma_ucs::EllipsoidalUncertaintySet: Ellipsoidal uncertainty set for covariance.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns and covariance using the specified bootstrap algorithm.
Computes deviations from prior statistics for each bootstrap sample.
Computes covariance matrices of deviations and constructs ellipsoidal uncertainty sets using the specified method and quantile.
Returns both sets as a tuple.
Related
PortfolioOptimisers.mu_ucs Function
mu_ucs(ue::ARCHUncertaintySet{<:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs a box uncertainty set for expected returns using bootstrap resampling for time series data.
Mathematical definition
Where:
, : Lower/upper bounds for expected return of asset . , : Quantile functions at level . : Bootstrap mean for asset in sample . : Significance level.
Arguments
ue: ARCH uncertainty set estimator.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns using the specified bootstrap algorithm.
Computes lower and upper bounds for expected returns using quantiles of bootstrapped samples.
Returns the expected returns box uncertainty set.
Related
PortfolioOptimisers.mu_ucs Function
mu_ucs(ue::ARCHUncertaintySet{<:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs an ellipsoidal uncertainty set for expected returns using bootstrap resampling for time series data.
Mathematical definition
Where:
: Empirical covariance of bootstrap mean deviations. : Estimated mean vector. : Ellipsoidal uncertainty set for expected returns. : Empirically fitted scaling parameter.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipsoidal algorithm, simulation parameters, block size, quantile, seed, and bootstrap type.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::EllipsoidalUncertaintySet: Ellipsoidal uncertainty set for expected returns.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns using the specified bootstrap algorithm.
Computes deviations from prior expected returns for each bootstrap sample.
Computes the covariance matrix of deviations and constructs an ellipsoidal uncertainty set using the specified method and quantile.
Returns the expected returns ellipsoidal uncertainty set.
Related
PortfolioOptimisers.sigma_ucs Function
sigma_ucs(ue::ARCHUncertaintySet{<:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs a box uncertainty set for covariance using bootstrap resampling for time series data.
Mathematical definition
Where:
, : Lower/upper covariance bounds. , : Quantile functions at level . : Bootstrap covariance element in sample . : Significance level.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, box algorithm, simulation parameters, block size, quantile, seed, and bootstrap type.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
sigma_ucs::BoxUncertaintySet: Covariance uncertainty set.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of covariance using the specified bootstrap algorithm.
Computes lower and upper bounds for covariance using quantiles of bootstrapped samples.
Returns the covariance box uncertainty set.
Related
PortfolioOptimisers.sigma_ucs Function
sigma_ucs(ue::ARCHUncertaintySet{<:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Constructs an ellipsoidal uncertainty set for covariance using bootstrap resampling for time series data.
Mathematical definition
Where:
: Empirical covariance of bootstrap covariance deviations (vectorised). : Estimated covariance matrix. : Ellipsoidal uncertainty set for covariance. : Empirically fitted scaling parameter.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipsoidal algorithm, simulation parameters, block size, quantile, seed, and bootstrap type.X: Data matrix to be resampled.F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
sigma_ucs::EllipsoidalUncertaintySet: Ellipsoidal uncertainty set for covariance.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of covariance using the specified bootstrap algorithm.
Computes deviations from prior covariance for each bootstrap sample.
Computes the covariance matrix of deviations and constructs an ellipsoidal uncertainty set using the specified method and quantile.
Returns the covariance ellipsoidal uncertainty set.
Related
PortfolioOptimisers.BootstrapUncertaintySetEstimator Type
abstract type BootstrapUncertaintySetEstimator <: AbstractUncertaintySetEstimatorAbstract type for estimators that construct uncertainty sets using bootstrap methods in portfolio optimisation.
Subtypes implement specific bootstrap algorithms (e.g., stationary, circular, moving block) to estimate uncertainty sets for risk or prior statistics.
Related
sourcePortfolioOptimisers.ARCHBootstrapSet Type
abstract type ARCHBootstrapSet <: AbstractAlgorithmAbstract type for bootstrap algorithms used in constructing uncertainty sets for time series data in portfolio optimisation.
Subtypes implement specific bootstrap methods using archpy.
Related
sourcePortfolioOptimisers.bootstrap_func Function
bootstrap_func(alg::ARCHBootstrapSet, block_size, X, seed)Creates a bootstrap generator for time series data using the specified bootstrap algorithm.
Arguments
alg: Bootstrap algorithm type.block_size: Size of blocks for resampling.X: Data matrix to be resampled.seed: Random seed for reproducibility.
Returns
- Returns a Python bootstrap generator object from the
arch.bootstrappackage.
Details
Dispatches to the appropriate bootstrap algorithm based on
alg.Uses Python's
arch.bootstrapviapyimportfor stationary, circular, or moving block bootstraps.The generator can be used to produce resampled datasets for uncertainty set estimation.
Related
sourcePortfolioOptimisers.bootstrap_generator Function
bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Generates bootstrapped samples of expected returns and covariance statistics for time series data using the specified bootstrap algorithm.
Arguments
ue: ARCH uncertainty set estimator.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mus::Matrix{<:Number}: Matrix of bootstrapped expected return vectors (size(X, 2) × ue.n_sim).sigmas::Array{<:Number, 3}): Array of bootstrapped covariance matrices (size(X, 2) × size(X, 2) × ue.n_sim).
Details
Uses the bootstrap algorithm specified in
ue.bootstrapto generate resampled datasets.For each bootstrap sample, computes the expected return and covariance using the prior estimator in
ue.pe.Stores the bootstrapped expected returns and covariances for uncertainty set estimation.
Related
sourcePortfolioOptimisers.mu_bootstrap_generator Function
mu_bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Generates bootstrap samples of expected return vectors for returns data using the specified bootstrap algorithm.
Arguments
ue: ARCH uncertainty set estimator.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mus::Matrix{<:Number}: Matrix of bootstrapped expected return vectors (size(X, 2) × ue.n_sim).
Details
Uses the bootstrap algorithm specified in
ue.bootstrapto generate resampled datasets.For each bootstrap sample, computes the expected return using the prior estimator in
ue.pe.Stores the bootstrapped expected returns for uncertainty set estimation.
Related
sourcePortfolioOptimisers.sigma_bootstrap_generator Function
sigma_bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Generates bootstrap samples of covariance matrices for time series data using the specified bootstrap algorithm.
Arguments
ue: ARCH uncertainty set estimator.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
sigmas::Array{<:Number, 3}: Array of bootstrapped covariance matrices (size(X, 2) × size(X, 2) × ue.n_sim).
Details
Uses the bootstrap algorithm specified in
ue.bootstrapto generate resampled datasets.For each bootstrap sample, computes the covariance using the prior estimator in
ue.pe.Stores the bootstrapped covariances for uncertainty set estimation.
Related
source