# [R] calculation problem

From: Amir Safari <amsa36060_at_yahoo.com>
Date: Thu 23 Feb 2006 - 23:26:54 EST

Dear R users,
I hope this mailing list be the right place for my question.

Usaully performance criterion of curve fitting like as Directinal Symmetry (DS) and Mean Absolute Percentage Error (MAPE) are correctly used with absolute time series which includes only positive values. But how it is possible to use DS and MAPE with other time series like as return series (for example return of a stock exchange index) which includes pasitive and negative values.

Certainly following codes could not be correct:

MAPE= ( (sum (abs( (y-fittedvalue) /y)) )/ n) *100   MAPE
y: real value
because sign of negative values are neglegted. If we code it as following:

absy=abs(y)
signy=sign(y)
absfittedvalue=abs(fittedvalue)
signfittedvalue=sign(fittedvalue)

MAPE= ( (sum (abs( (absy-absfittedvalue) /absy)) )/ n) *100   MAPE=MAPE*signy*signfittedvalue

also would not be correct. But how can we cope with this difficulty?   For remainder DS could be got by:

DS= sum(dt=(yt-yt-1)*(fittedvaluet-fittedvaluet-1))*100/N

dt=1 if (yt-yt-1)*(fittedvaluet-fittedvaluet-1)>=0    dt=0 otherwise

Thanks a lot for any idea.
Amir Safari

[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list