Bootstrap Uncertainty Sets: private API
PortfolioOptimisers.bootstrap_generator — Function
bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Refits the mean and the covariance on every block bootstrap resample of X, in one pass over one index stream.
Both statistics are read from the same resample, so a caller that needs both axes gets them from ue.n_sim index vectors rather than from two independent runs of ue.n_sim each.
Algorithm
- Read the observation count
TfromX, and allocatemusandsigmas. - Resolve the generator with
resolve_rng, givingrng. A setue.seedgives a private reseeded copy, so the stream restarts at the same place on every call andue.rngis never advanced. An unsetue.seedgivesue.rngitself, so the stream continues where the previous call left it. - For each of the
ue.n_simsimulations, draw one index vector withbootstrap_indicesand take those rows ofX, giving the resampleXi. - Fit
ue.meonXi, giving one column ofmus. - Fit
ue.ceonXi, giving one slice ofsigmas. Steps 4 and 5 read the sameXi, which is what pairs the two statistics. - Return
musandsigmas.ue.pefits the point estimate the deviations are taken from, and takes no part here.
Arguments
ue: ARCH uncertainty set estimator.X: Data matrix to be resampled, one row per observation.kwargs...: Additional keyword arguments passed toue.meandue.ce.
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).
Related
PortfolioOptimisers.mu_bootstrap_generator — Function
mu_bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Refits the mean on every block bootstrap resample of X, and fits no covariance.
The index stream is the one bootstrap_generator walks, drawn one vector per simulation. A set ue.seed restarts it at the same place, so this function sees the same resamples as its two siblings; an unset ue.seed does not, and the three then walk different parts of one shared stream.
Algorithm
- Read the observation count
TfromX, and allocatemus. - Resolve the generator with
resolve_rng, givingrng. A setue.seedgives a private reseeded copy, so the stream restarts at the same place on every call andue.rngis never advanced. An unsetue.seedgivesue.rngitself, so the stream continues where the previous call left it. - For each of the
ue.n_simsimulations, draw one index vector withbootstrap_indicesand take those rows ofX, giving the resampleXi. - Fit
ue.meonXi, giving one column ofmus. - Return
mus.ue.ceis not read, andue.pefits the point estimate the deviations are taken from and takes no part here.
Arguments
ue: ARCH uncertainty set estimator.X: Data matrix to be resampled, one row per observation.kwargs...: Additional keyword arguments passed toue.meandue.ce.
Returns
mus::Matrix{<:Number}: Matrix of bootstrapped expected return vectors (size(X, 2) × ue.n_sim).
Related
PortfolioOptimisers.sigma_bootstrap_generator — Function
sigma_bootstrap_generator(ue::ARCHUncertaintySet, X::MatNum; kwargs...)Refits the covariance on every block bootstrap resample of X, and fits no mean.
The index stream is the one bootstrap_generator walks, drawn one vector per simulation. A set ue.seed restarts it at the same place, so this function sees the same resamples as its two siblings; an unset ue.seed does not, and the three then walk different parts of one shared stream.
Algorithm
- Read the observation count
TfromX, and allocatesigmas. - Resolve the generator with
resolve_rng, givingrng. A setue.seedgives a private reseeded copy, so the stream restarts at the same place on every call andue.rngis never advanced. An unsetue.seedgivesue.rngitself, so the stream continues where the previous call left it. - For each of the
ue.n_simsimulations, draw one index vector withbootstrap_indicesand take those rows ofX, giving the resampleXi. - Fit
ue.ceonXi, giving one slice ofsigmas. This is the first of the two places the ellipsoidal route readsue.ce. - Return
sigmas.ue.meis not read, andue.pefits the point estimate the deviations are taken from and takes no part here.
Arguments
ue: ARCH uncertainty set estimator.X: Data matrix to be resampled, one row per observation.kwargs...: Additional keyword arguments passed toue.meandue.ce.
Returns
sigmas::Array{<:Number, 3}: Array of bootstrapped covariance matrices (size(X, 2) × size(X, 2) × ue.n_sim).
Related