Moving Average algorithm, problem or not?
Posted: Tue Mar 03, 2009 11:43 am
Hi everybody!
I have the following problem with Moving Average:
I do the project for my University and use the standard function MovingAverage.createMovingAverage( tm7 , "7 day m.a." , 7, 7), but my project manager said that the standard function computed the values wrong, although he used the same formula as JFreeChart. I tried to understand why and calculated MovingAverage for some points manually. I got the following results, for example for MovingAverage for the period 17.02.09-23.02.09:
21.02.09 and 22.02.09 was a weekend and JFreeChart skip the days and use only 5 values for computation MovingAverage for 7 days:
(value(17.02.09) + value(18.02.09) + value(19.02.09)+ value(20.02.09)+ value(23.02.09))/5
the project manager whant th have:
(value(13.02.09) + value(16.02.09) + value(17.02.09) + value(18.02.09) + value(19.02.09)+ value(20.02.09)+ value(23.02.09))/7
(14.02.09 and 15.02.09 was a weekend too)
I think that JFreeChart can't compute something wrong and the computation of MA as my project manager is very complicated and has no sense. Can anyone give me the explanation, whether I am right or not?
Thank you!
I have the following problem with Moving Average:
I do the project for my University and use the standard function MovingAverage.createMovingAverage( tm7 , "7 day m.a." , 7, 7), but my project manager said that the standard function computed the values wrong, although he used the same formula as JFreeChart. I tried to understand why and calculated MovingAverage for some points manually. I got the following results, for example for MovingAverage for the period 17.02.09-23.02.09:
21.02.09 and 22.02.09 was a weekend and JFreeChart skip the days and use only 5 values for computation MovingAverage for 7 days:
(value(17.02.09) + value(18.02.09) + value(19.02.09)+ value(20.02.09)+ value(23.02.09))/5
the project manager whant th have:
(value(13.02.09) + value(16.02.09) + value(17.02.09) + value(18.02.09) + value(19.02.09)+ value(20.02.09)+ value(23.02.09))/7
(14.02.09 and 15.02.09 was a weekend too)
I think that JFreeChart can't compute something wrong and the computation of MA as my project manager is very complicated and has no sense. Can anyone give me the explanation, whether I am right or not?
Thank you!