I have in my head a very simple concept, but it's difficult to search for. I feel like there must be a function for this in statistics, but I have no idea what to look for.

I have a 1 dimensional data set, a simple column of numbers. Let's say it's {1, 3, 6, 8, 5}. I want to find the absolute average difference, or step, between each data point. In this case the differences would be {2, 3, 2, 3}, so the average would be 2.5.

This post is after the same data, and I know I can generate a second set of data, then average it. But is there a statistical function that does this on the data set directly, without having to make an intermediate data set?

Thanks, Ian

Edit: Clarification regarding absolute steps

  • $\begingroup$ I am not sure, just in case: it could be the moving average: en.wikipedia.org/wiki/Moving_average $\endgroup$ – iadvd Sep 11 '15 at 6:03
  • $\begingroup$ All you have to do is subtract the 1st term from the last, and then divide by one less than the number of terms. $(11-1)/(5-1)=2.5$. $\endgroup$ – Gerry Myerson Sep 11 '15 at 6:37
  • $\begingroup$ Nice approach @GerryMyerson. Unfortunately I neglected to say I am not interested in -ve values, I want absolute steps. I've updated the question. $\endgroup$ – Ian Sep 11 '15 at 22:55
  • $\begingroup$ Then I don't think there's any way to compute $(1/n)\sum_1^n|a_j-a_{j-1}|$ without computing the individual numbers $|a_j-a_{j-1}|$. $\endgroup$ – Gerry Myerson Sep 11 '15 at 23:11
  • $\begingroup$ It's not the answer I was looking for, but fair enough. If you post it as an answer @GerryMyerson, I'll mark it as such. $\endgroup$ – Ian Sep 13 '15 at 23:25

I don't think there is any way to compute $${1\over n}\sum_{j=1}^n|a_j-a_{j-1}|$$ without computing the individual numbers $|a_j-a_{j-1}|$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.