Spikes in time series I would like a simplified measure to quantify spikes in my time series, I have one series that has many and I would like to compare it to another that has very few. I have thought through several options for example fitting a sine wave and looking at the R values as a measure of smoothness etc but I thought that a measure of the Coefficient of variation of the differences in the series may be suitable. I was wondering if this was a good approach and also as the mean values of the differences are very small I was wondering if theres a common alternative for the CV which of course would become meaningless. 

Also just to mention that there is no proportionality between the means and standard deviations of the data.

Another way to ask this question would be if anyone had suggestions for the inverse, a successful measurement of smoothness? or a way to summarise jerking in the data
I would try a median filter.


Let your original signal be $f[n]$.
Median filter $f[n]$ using $N$ pixels, where $N &gt; 2 \times S + 1$, where $S$ is the maximum number of samples in the spike. The resulting signal, lets call it $g[n]$ should have all the spikes removed.
Find the absolute of the difference between the two signals, $h[n] = |f[n] - g[n]|$. This signal represents the spikes.
Count the number of positive transitions in $h[n]$ that are above a threshold. This is the number of spikes.


Example:

Original signal $f[n]$



Median filtered signal $g[n]$



Absolute difference $h[n]$