0

I’m having 1d time series and I would like to measure it’s smoothness or roughness

whuber
  • 281,159
  • 54
  • 637
  • 1,101
  • Welcome to CV. The answer depends on what you intend this measure to tell you: could you be more specific? – whuber Jan 23 '20 at 21:07
  • moving average of absolute differences or higher order differences is a simple approach. lookup "roughness penalty", e.g. https://en.wikipedia.org/wiki/Smoothing_spline – Aksakal Jan 23 '20 at 21:13
  • 1
    Perhaps a duplicate of https://stats.stackexchange.com/q/24607/159 – Rob Hyndman Jan 23 '20 at 22:09

1 Answers1

3

Smoothing splines are constructed using a smoothness penalty as follows

$\int f''(x)^2 dx$

So you could use this as a metric, in place of the integral you'd sum across all points, and approximate the 2nd derivative using finite-difference. i.e.

$\frac{1}{\#x}\sum_i \left(x_{i-1} -2 x_i + x_{i+1}\right)^2$

Edit: Added $\frac{1}{\#x}$ as normalisation

David Waterworth
  • 516
  • 3
  • 11