# Harmonic and Geometric Moving Averages Calculator

Given a list of ordered data, you can construct the n-point moving average (or rolling average) by finding the average of each set of n consecutive points. Traditionally, one takes the arithmetic mean of the data points, however, it is also possible to calculate the geometric average or harmonic mean of the data. For example, suppose you have the ordered data set

1.53, 0.9, 1.4, 0.85, 0.7, 1.12, 1.74, 1.32

which represents the percent increase/decrease in a certain quantity. When averaging percent changes, it makes more sense to compute the geometric mean, rather than the arithmetic mean. In this example, the 3-point moving geometric average is

1.245, 1.023, 0.941, 0.873, 1.109, 1.37

You can use the calculator below to find the moving harmonic or geometric average of an ordered data set.

 Enter comma-separated data here. DO NOT end list with a comma. Number of Consecutive Points to Average: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 20 21 25 28 30 35 40 50 60 100 Type of Mean: GeometricHarmonic Moving average will be output here.

#### Recursive Formula for Geometric Moving Average and Harmonic Moving Average

If the number of terms in the original set is d and the number of terms used in each average is n, then the number of terms in the moving average sequence will be

d - n + 1.

If xi is the ith data point and Gi is the moving geometric average up to the ith data point, then Gi can be calculated with a simple recursion:

Gi+1 = (Gi)(xi+1/xi-n+1)1/n

where n is the number of periods used in the moving average. Likewise, you can recursively compute each moving harmonic average term Hi with a recurrence equation:

Hi+1 = n/[n/Hi + 1/xi+1 - 1/xi-n+1]