Bootstrap Uncertainty Sets
PortfolioOptimisers.StationaryBootstrap Type
struct StationaryBootstrap <: ARCHBootstrapSet endBootstrap algorithm for constructing uncertainty sets using a stationary bootstrap in time series data.
Related Types
sourcePortfolioOptimisers.CircularBootstrap Type
struct CircularBootstrap <: ARCHBootstrapSet endBootstrap algorithm for constructing uncertainty sets using a circular bootstrap in time series data.
Related Types
sourcePortfolioOptimisers.MovingBootstrap Type
struct MovingBootstrap <: ARCHBootstrapSet endBootstrap algorithm for constructing uncertainty sets using a moving bootstrap in time series data.
Related Types
sourcePortfolioOptimisers.ARCHUncertaintySet Type
struct ARCHUncertaintySet{T1, T2, T3, T4, T5, T6, T7} <: BootstrapUncertaintySetEstimator
pe::T1
alg::T2
n_sim::T3
block_size::T4
q::T5
seed::T6
bootstrap::T7
endEstimator for box or ellipse uncertainty sets using bootstrap methods for time series data in portfolio optimisation.
Fields
pe: Prior estimator used to compute expected returns and covariance statistics.alg: Uncertainty set algorithm.n_sim: Number of bootstrap simulations for uncertainty set estimation.block_size: Size of blocks for bootstrap resampling.q: Quantile or confidence level for uncertainty set bounds.seed: Optional random seed for reproducibility.bootstrap: Bootstrap algorithm type.
Constructors
ARCHUncertaintySet(; pe::AbstractPriorEstimator = EmpiricalPrior(),
alg::AbstractUncertaintySetAlgorithm = BoxUncertaintySetAlgorithm(),
n_sim::Integer = 3_000, block_size::Integer = 3, q::Real = 0.05,
seed::Union{Nothing, <:Integer} = nothing,
bootstrap::ARCHBootstrapSet = StationaryBootstrap())Keyword arguments correspond to the fields above.
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 ┼ DefaultMatrixProcessing
│ │ │ pdm ┼ Posdef
│ │ │ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ │ │ denoise ┼ nothing
│ │ │ detone ┼ nothing
│ │ │ alg ┴ nothing
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ horizon ┴ nothing
alg ┼ BoxUncertaintySetAlgorithm()
n_sim ┼ Int64: 3000
block_size ┼ Int64: 3
q ┼ Float64: 0.05
seed ┼ nothing
bootstrap ┴ StationaryBootstrap()Related
PortfolioOptimisers.ucs Function
ucs(ue::ARCHUncertaintySet{<:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs box uncertainty sets for expected returns and covariance statistics using bootstrap resampling for time series data.
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 compute statistics.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
(mu_ucs::BoxUncertaintySet, sigma_ucs::BoxUncertaintySet): Expected returns and covariance uncertainty sets.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns and covariance using the specified bootstrap algorithm.
Calculates 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, <:EllipseUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs ellipse uncertainty sets for expected returns and covariance statistics using bootstrap resampling for time series data.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipse 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 compute statistics.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
(mu_ucs::EllipseUncertaintySet, sigma_ucs::EllipseUncertaintySet): Tuple containing ellipse uncertainty sets for expected returns and covariance.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of expected returns and covariance using the specified bootstrap algorithm.
Calculates deviations from prior statistics for each bootstrap sample.
Computes covariance matrices of deviations and constructs ellipse 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::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs a box uncertainty set for expected returns using bootstrap resampling for time series data.
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 compute statistics.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.
Calculates 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, <:EllipseUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs an ellipse uncertainty set for expected returns using bootstrap resampling for time series data.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipse 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 compute statistics.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::EllipseUncertaintySet: Ellipse 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.
Calculates deviations from prior expected returns for each bootstrap sample.
Computes the covariance matrix of deviations and constructs an ellipse uncertainty set using the specified method and quantile.
Returns the expected returns ellipse uncertainty set.
Related
PortfolioOptimisers.sigma_ucs Function
sigma_ucs(ue::ARCHUncertaintySet{<:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs a box uncertainty set for covariance using bootstrap resampling for time series data.
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 compute statistics.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.
Calculates 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, <:EllipseUncertaintySetAlgorithm, <:Any, <:Any,
<:Any, <:Any, <:Any}, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)Constructs an ellipse uncertainty set for covariance using bootstrap resampling for time series data.
Arguments
ue: ARCH uncertainty set estimator. Contains prior estimator, ellipse 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 compute statistics.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
sigma_ucs::EllipseUncertaintySet: Ellipse uncertainty set for covariance.
Details
Computes prior statistics using the provided prior estimator.
Generates bootstrap samples of covariance using the specified bootstrap algorithm.
Calculates deviations from prior covariance for each bootstrap sample.
Computes the covariance matrix of deviations and constructs an ellipse uncertainty set using the specified method and quantile.
Returns the covariance ellipse uncertainty set.
Related
PortfolioOptimisers.BootstrapUncertaintySetEstimator Type
abstract type BootstrapUncertaintySetEstimator <: AbstractUncertaintySetEstimator endAbstract 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 Types
sourcePortfolioOptimisers.ARCHBootstrapSet Type
abstract type ARCHBootstrapSet <: AbstractAlgorithm endAbstract type for bootstrap algorithms used in constructing uncertainty sets for time series data in portfolio optimisation.
Subtypes implement specific bootstrap methods using archpy.
Related Types
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::AbstractMatrix; 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{<:Real}, sigmas::Array{<:Real, 3}): Tuple containing the matrix of bootstrapped expected return vectors (size(X, 2) × ue.n_sim), 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::AbstractMatrix; 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{<:Real}: 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::AbstractMatrix; 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{<:Real, 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