Computes the interquartile range (IQR) of a one-dimensional signal – the
spread of the middle 50%, \(Q_3 - Q_1\) – a robust, quantile-based measure
of dispersion that ignores the tails entirely. The quartiles use R's default
type-7 quantile (the same linear interpolation as
scipy.stats.iqr and numpy.percentile), so the result matches both
bit-for-bit.
Arguments
- x
A numeric vector (the time series).
- type
Quantile algorithm passed to
quantile(default7, matching base R, scipy and numpy).
Details
A quantile-based robust spread that complements medianAbsDev (a
deviation-based robust scale) and signalMoments (the classical
SD). For approximately Gaussian data, \(\mathrm{IQR} / (2\,\Phi^{-1}(0.75))\)
(\(\approx \mathrm{IQR}/1.349\)) is a robust estimate of the SD; a value well
below the SD flags a skewed or heavy-tailed distribution.
See also
medianAbsDev for the deviation-based robust scale,
signalMoments for the classical moments.