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

Kolmogorov-Smirnov tests for a non-homogeneous Poisson arrival process. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <functional>
#include <string>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for infer_nhpp_ks.h:

Go to the source code of this file.

Classes

struct  line::infer::NhppKsResult< T >
 Outcome of the KS test. More...

Namespaces

namespace  line
namespace  line::infer

Enumerations

enum class  line::infer::NhppKsMethod { line::infer::Cu , line::infer::Lewis }
 Which test to run on the conditional-uniform data. More...

Functions

template<class Tv>
NhppKsResult< Tv > line::infer::infer_nhpp_ks (const std::vector< Tv > &times, const Tv &T, const std::function< Tv(const Tv &)> &cumRate=std::function< Tv(const Tv &)>(), NhppKsMethod method=NhppKsMethod::Lewis, const Tv &T0=num_traits< Tv >::from_int(0))
 Kolmogorov-Smirnov tests for a non-homogeneous Poisson arrival process.

Detailed Description

Kolmogorov-Smirnov tests for a non-homogeneous Poisson arrival process.

Templated port of matlab/src/api/infer/infer_nhpp_ks.m, cross-checked against jar/src/main/java/jline/api/infer/InferNhppKs.java.

THE CONDITIONAL-UNIFORM TRANSFORMATION. Conditional on the number of arrivals in [T0,T], the arrival times of an NHPP are the order statistics of iid variables with cdf Lambda(t)/Lambda(T). Mapping the data through that cdf turns ANY NHPP, whatever its rate, into iid uniforms, so one KS test covers every rate function.

WHY THE PLAIN TEST IS WEAK, AND WHAT FIXES IT. The CU KS test has "remarkably little power" against non-exponential interarrival times: it looks at the POSITIONS of the points, and those stay nearly uniform for many non-Poisson processes. Lewis (1965) applies the Durbin (1961) transformation first – reorder the GAPS ascending, rescale each by how many gaps remain, cumulate – which turns a difference in the gap DISTRIBUTION into a difference in position. Measured on 400 replications of an Erlang-4 renewal process, the CU test rejects at its own size while the Lewis test rejects essentially always.

ARITHMETIC. exp and sqrt in the p-value: transcendental only.

Reference: S.-H. Kim, W. Whitt (2014). Are call center and hospital arrivals well modeled by nonhomogeneous Poisson processes? M&SOM 16(3), 464-480; J. Durbin (1961), Biometrika 48, 41-55; P. A. W. Lewis (1965), JRSS B 27.

Definition in file infer_nhpp_ks.h.