In so-called time-series data, where values change over time, it is important to know whether the values are trending upward, downward, or flat over time in order to predict future values. For example, stock price charts often show moving averages, and you can use this to understand stock price trends and make future buying and selling decisions.
By the way, in the current latest version of JMP 16, when drawing a smooth line using the Graph Builder, an option to use "Moving Average" has been added as a smoothing method. However, when considering moving averages, it is important to note that there are broadly two calculation methods:
A. Moving average using previous and subsequent data
B. Moving average using previous (past) data
The graph builder mentioned above also allows you to distinguish between the two.
Moving average calculation example
To demonstrate an example of calculating a moving average, we will use the following simple data. For example, you can think of it as time series data that shows the number of visitors (value) for each day of a certain store.

Here, if you calculate the "5-day moving average" using methods A and B above, it will be as follows.
A. Before and after data
(Data from the past two points + current data + data from two future points) ÷ 5
Example: 5-day moving average for day 6
(80 + 150 + 120 + 120 + 70) ÷ 5 = 108
B. Previous data only
(Data from the past 4 points + current data) ÷ 5
Example: 5-day moving average for day 6
(130 + 140 + 80 + 150 + 120) ÷ 5 = 124
Looking at the example for the 6th day, you can see that the moving average value varies greatly depending on the calculation method.
Both methods of calculating moving averages are often used, but if you are mainly using moving averages to predict the future, as in the first stock price example, then method B (using only previous data) is recommended. Become. Of course, we don't have any future data at this point.
Draw a moving average with graph builder
To add a moving average line in JMP 16's Graph Builder, specify "Moving Average" as the smooth line method, as shown below.
| English |
Japanese |

|

|
A smooth line drawn using the default method is A. Before and after data It is calculated by
In the image below, the option Local width at the bottom left is set to "5" and a 5-day moving average line is drawn. (Additionally, Trim is set to maximum.)
5-day moving average (A. (using data before and after)

If you set a large Trim value, it will become a moving average line from Day = 3 to Day 14. It is in this interval that the 5-day moving average can be calculated properly as defined.
So, B. Previous data only How can I calculate it?
Specify Trailing (front section) from the smooth line red triangle button at the bottom left of the window as follows.
| English |
Japanese |

|

|
5-day moving average (B. (use previous data)

Also, if you set Trim to a large value, it will become a moving average line from Day 5 to Day 16. From the graph, you can see that the recent number of customers has been on a downward trend. It may be necessary to take some measures, such as running a campaign.
Showing trends in the number of coronavirus infections in Japan using moving averages
In Japan, there is a large difference in the number of tests on weekdays and holidays, and since there are 7 days in a week, there are many cases where the "7-day average" is considered. How to draw a 7-day average moving average graph? yes, B. Previous data only will be used. The figure below is a graph showing the daily number of new coronavirus infections in Japan, and the red curve is Trailing (front section) It is a 7-day moving average drawn using the option.

Strangely enough, even now in December, the number of new coronavirus infections in Japan is on the decline. I don't know what the impact of the new mutant strain will be in the future, but I hope that the number of infected people will remain at a low level and the economy will recover.