LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mtrace_bootstrap.h File Reference

Block-bootstrap confidence intervals for the descriptors of a marked trace. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/pfqn/pfqn_mc_common.h"
#include "line/api/sim/sim_dist.h"
#include "line/api/trace/mtrace_moment.h"
#include "line/api/trace/mtrace_pc.h"
#include "line/api/trace/mtrace_sigma.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for mtrace_bootstrap.h:

Go to the source code of this file.

Classes

struct  line::trace::MtraceBootstrapResult< T >
 Lower and upper BCa endpoints of each descriptor, and the point estimate. More...

Namespaces

namespace  line
namespace  line::trace

Functions

template<class T>
MtraceBootstrapResult< T > line::trace::mtrace_bootstrap (const std::vector< T > &Tv, const std::vector< int > &A, pfqn::McRng &rng, std::size_t resamples=1000, double alpha=0.05, std::size_t blockLen=50)
 Block-bootstrap confidence intervals for the descriptors of a marked trace.

Detailed Description

Block-bootstrap confidence intervals for the descriptors of a marked trace.

Templated port of matlab/lib/m3a/m3a/mtrace/mtrace_bootstrap.m.

The statistic is the whole descriptor vector the m3a fitters consume – [pc, backward moment, forward moment, sigma] – and the resampling is by BLOCK, not by observation: the trace is cut into BN = floor(N / 50) contiguous blocks and the blocks are resampled with replacement. That is the point of the routine. An inter-arrival trace is autocorrelated, and resampling individual observations would destroy exactly the dependence the descriptors measure, giving intervals far too narrow for sigma and the forward moment.

The intervals are BCa (bias-corrected and accelerated), which is what MATLAB's bootci computes by default: z0 = Phi^-1( #{theta* < theta_hat} / R ), a = sum(d^3) / (6 (sum d^2)^{3/2}) over the jackknife deviations d, alpha1,2 = Phi( z0 + (z0 -+ z_alpha) / (1 - a (z0 -+ z_alpha)) ), and the endpoints are the alpha1 and alpha2 quantiles of the replicates. The bias correction z0 and the acceleration a are what make BCa transformation respecting, which matters here because several descriptors are probabilities.

THE THREE CODEBASES DISAGREE ON WHAT THIS FUNCTION IS. MATLAB returns confidence intervals as above. The JAR returns a statistics object with configurable block size and seed. Native Python returns a resampled (T, A) pair – a sampler, not an estimator, and no interval at all. MATLAB is the reference and is what is ported; the divergence is recorded rather than papered over, because a caller reading the Python name expects a trace back.

RANDOMNESS. line::pfqn::McRng by reference, the tree's convention. The stream is not comparable with MATLAB's, so the oracle is distributional: the interval must cover the point estimate and shrink as R grows.

ARITHMETIC: transcendental, for the normal quantiles.

Definition in file mtrace_bootstrap.h.