Mean absolute percentage error

Hi there,

I have two waves that I want to compare in order to determine how different/similar they are. One wave has 2000 points and the other has 236 points. I wanted to use the mean absolute percentage error as my metric of difference but I think that requires the two waves to have the same number of points. In addition to that, the large wave is defined via an x-value of 270 to 320 in evenly spaced increments of 0.025 while the smaller wave is defined via an x-value of 270 to 348.99 in nonuniform steps.

What's a good way to go about consolidating their sizes? Does IGOR have a built-in function that allows me to readily compare them?


Sample Waves

These waves are VERY different... This whole thing does not make much sense. 

Here is what I would do:

Duplicate y2, y1short
y1short = interp(x2, x1, y1 )
Duplicate y2, Difference
Difference = abs((y2-y1short)/y2)
print sum(Difference, 0, BinarySearch(x2, 320 ))

The fist line creates wave for short version of y1

Second line fills it up with interpolated values from y1/x1 par at x2 values. Now y2 and y1 have same number of points and are for same x values. 

Third line creates wave for the difference.

Fourth line calculates differences for each point and divides by whichever wave you consider base. And takes absolute value of that. You may need to modify this so it gives what you need. May be scale by 100 to make it %? 

Now, we need to make sure we use data only in the overlapping range of x values. Based on what you said above, you can use simply minimum 270 and 320, since both data sets start at same x value, we can use from point 0. But only up to point, where x<=320. BinarySearch(x2, 320 ) finds that point number for us. 

Therefore results can be obtained doing sum(Difference, 0, BinarySearch(x2, 320 )) - sum of the calculated Differences between points 0 (where x2=0) and point number, where x2<=320, end of the overlapping region. 

No guarantees, there may be some bugs in this. 

Now, I tried to do this, but the values in y1 and y2 are so different, it seem meaningless max of y2 is 1.5 while for y1 it is 1.6e10 :

•wavestats y1
  V_npnts= 2000; V_numNaNs= 0; V_numINFs= 0; V_avg= 5.86345e+09; 
  V_Sum= 1.17269e+13; V_sdev= 4.23897e+09; V_sem= 9.47863e+07; 
  V_rms= 7.23463e+09; V_adev= 3.59572e+09; V_skew= -0.187221; 
  V_kurt= -1.24415; V_minloc= 0; V_maxloc= 601; V_min= 0; 
  V_max= 1.64566e+10; V_minRowLoc= 0; V_maxRowLoc= 601; 
  V_startRow= 0; V_endRow= 1999; 
•wavestats y2
  V_npnts= 236; V_numNaNs= 0; V_numINFs= 0; V_avg= 1.37021; 
  V_Sum= 323.369; V_sdev= 0.656998; V_sem= 0.0427669; 
  V_rms= 1.51898; V_adev= 0.549667; V_skew= -0.232631; 
  V_kurt= -0.810713; V_minloc= 37; V_maxloc= 60; V_min= 0.293419; 
  V_max= 3.10107; V_minRowLoc= 37; V_maxRowLoc= 60; V_startRow= 0; 
  V_endRow= 235;