A bit of a bizarre question here -- I'm looking for assistance in generating a robust metric to measure how monotonically "step-wise" a series of values is. The set must not start or end at a specific value, and the differences between each step should not matter, but should be internally fairly consistent within the set. Either increasing or decreasing sets of values are both acceptable, but should be monotonic.
As an example, this set of values should have a high score:
{ 0, 0, 0, 5, 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15 }
Another (slightly lower-scoring) set of values might be:
{ 50, 50, 50, 50, 62, 62, 50, 62, 80, 80, 80, 80, 100, 100, 80, 100 }
Notice the "noise" wherein a value of 50 is present within the set of 62s and a value of 80 is present within the 100s. This noise should reduce the score.
The lower-scoring set of values would be increasingly random, with completely random signals hopefully giving "scores" near 0.
I was thinking some kind of line-fit might do the trick, but it's difficult because the series is inherently discrete, and scoring by the offset from the line would give artificially poor results even for very nice "steppy" functions.
Any ideas on some kind of metric or programmatic approach to help solve this problem?
Thanks!