In a cumulative moving average, the data arrive in an ordered datum stream and the statistician would like to get the average of all of the data up until the current datum point. For example, an investor may want the average price of all of the stock transactions for a particular stock up until the current time. As each new transaction occurs, the average price at the time of the transaction can be calculated for all of the transactions up to that point using the cumulative average, typically an unweighted average of the sequence of i values x1, ..., xi up to the current time:
The brute-force method to calculate this would be to store all of the data and calculate the sum and divide by the number of datum points every time a new datum point arrived. However, it is possible to simply update cumulative average as a new value xi+1 becomes available, using the formula:
where can be taken to be equal to 0.
Thus the current cumulative average for a new datum point is equal to the previous cumulative average plus the difference between the latest datum point and the previous average divided by the number of points received so far. When all of the datum points arrive (i = N), the cumulative average will equal the final average.
The derivation of the cumulative average formula is straightforward. Using
and similarly for i + 1, it is seen that
Solving this equation for CAi+1 results in:
Read more about this topic: Moving Average
Famous quotes containing the words cumulative, moving and/or average:
“But while ignorance can make you insensitive, familiarity can also numb. Entering the second half-century of an information age, our cumulative knowledge has changed the level of what appalls, what stuns, what shocks.”
—Anna Quindlen (b. 1952)
“The women made a plan to dig their own graves and they said, We will stand beside our graves because we are not moving from here. You can shoot and we will lie in our land forever.”
—Sheena Duncan (b. 1932)
“You preferred it to the usual thing:
One dull man, dulling and uxorious,
One average mindwith one thought less, each year.”
—Ezra Pound (18851972)