calculation problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

calculation problem

Amir Safari
 
   
   
   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]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html