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

Bias-corrected sample skewness (MATLAB's skewness(S,0), equivalently the G1 estimator). More...

#include <cstddef>
#include <vector>
#include "line/api/trace/trace_mean.h"
#include "line/api/trace/trace_types.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for trace_skew.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::trace

Functions

template<class T>
line::trace::trace_skew (const std::vector< T > &S)
 Bias-corrected sample skewness (MATLAB's skewness(S,0), equivalently the G1 estimator).

Detailed Description

Bias-corrected sample skewness (MATLAB's skewness(S,0), equivalently the G1 estimator).

Templated port of matlab/lib/kpctoolbox/trace/trace_skew.m, cross-checked against jar/src/main/java/jline/api/trace/TraceSkew.java, which delegates to Apache Commons Math's Skewness. The two are algebraically IDENTICAL: Apache computes n/((n-1)(n-2)) * sum d^3 / s^3 with s the n-1 standard deviation, MATLAB computes m3/m2^{3/2} * sqrt((n-1)/n) * n/(n-2), and both reduce to

G1 = sqrt(n(n-1)) / (n-2) * m3 / m2^{3/2}, m_k = (1/n) sum (x-xbar)^k.

That closed form is what is evaluated here, so the result is symmetric in the two references rather than favouring one rounding order.

ARITHMETIC: a 3/2 power of the second central moment. static_assert(num_traits<T>::has_transcendental)

Definition in file trace_skew.h.