3
$\begingroup$

I’ve a data set contains two columns: actual value and target value. Is there a way where I can express the difference between these two columns as a single percentage value (that’s standardized, i.e., between 0-100%)? So I was wondering if I can calculate the standard deviation for the difference between values and then how can I standardize it to be a percentage between 0-100%?

Any help will be appreciated.

$\endgroup$
  • $\begingroup$ It depends on what you mean by "difference as a percentage value" -- percentage of what, exactly? That is, what is it you want to measure? And, very much relatedly, what is it about the problem that makes it necessary that the error stay between 0 and 1 (100%)? Is the 'target' some kind of gold standard you want to measure the deviation from, or is it that you want to measure how far the target is relative to the actual? (And if you want either of those, how does that fit with the 0-1 restriction?) $\endgroup$ – Glen_b Jun 20 '13 at 21:18
3
$\begingroup$

Sounds like you want to calculate Mean Absolute Percent Error. In R, you could do this as follows (assuming t is your target and a is your actual):

mean(abs(a-t)/a) * 100

MAPE

(Image from Wikipedia, A=Actual, F=forecast or target)

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ But MAPE can be larger than 100%. $\endgroup$ – Scortchi - Reinstate Monica Jun 20 '13 at 18:48
  • 1
    $\begingroup$ This can exceed 100%. E.g., let the (target, actual) data be $((100, 100), (101, 1))$. Then $M = \frac{1}{2}\left(|\frac{100-100}{100}| + |\frac{1-101}{1}|\right)$ = $50$ = $5000$%. You might have been thinking of mean absolute relative percent difference, which does the trick provided all actual and target values are positive. (I'm not recommending this, though: in such cases, measures based on logarithms are better.) $\endgroup$ – whuber Jun 20 '13 at 18:49
  • $\begingroup$ @whuber: yes, both actual and target values are positive. What do you recommend here? Thanks! $\endgroup$ – user9292 Jun 20 '13 at 19:14
  • $\begingroup$ I hesitate to recommend anything because I do not know why you want to do this and I am ignorant of the nature of your data (except now I know they are all positive). $\endgroup$ – whuber Jun 20 '13 at 19:16
  • 1
    $\begingroup$ In that case you shouldn't insist the results lie between 0 and 100%. Your verbal description translates to subtracting the total daily target from the total parts made during the day and expressing that difference--which may be negative or positive and even greater than 100%--as a percentage of the total target. $\endgroup$ – whuber Jun 20 '13 at 20:23

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.