In so-called time-series data, where the value changes over time, it is important to determine whether the value is on an upward trend, a downward trend, or a flat value over time in order to predict future values. For example, stock charts often show moving averages, which help you understand stock price trends and make future trading decisions.
By the way, in the latest version of JMP 16 at the moment, when drawing a smooth line with Graph Builder, the option of "moving average" has been added as a smoothing method. However, when considering the moving average, it should be noted that there are two main calculation methods.
A. Moving average using data before and after
B. Moving average using previous (past) data
The graph builder mentioned above can also be used to distinguish between the two.
Moving average calculation example
To show an example of moving average calculation, we will explain with the following simple data. For example, you can think of it as time-series data showing the number of visitors (Value) for each day of a store.

Here, the "5-day moving average" is calculated by the above methods A and B as follows.
A. Data before and after
(Data at the past 2 points + Current data + Data at the future 2 points) ÷ 5
Example: 5-day moving average for the 6th day
(80 + 150 + 120 + 120 + 70) ÷ 5 = 108
B. Previous data only
(Data at the past 4 points + Current data) ÷ 5
Example: 5-day moving average for the 6th day
(130 + 140 + 80 + 150 + 120) ÷ 5 = 124
Looking at the example on the 6th day, we can see that the value of the moving average differs greatly depending on the calculation method.
Both methods of calculating the moving average are often used, but if you want to use the moving average mainly for future forecasts, as in the stock price example given at the beginning, use method B (use only the previous data). Become. Of course, there is no future data at this time.
Draw a moving average with Graph Builder
To add a moving average line in the JMP 16 Graph Builder, specify "moving average" as the smoothing method as follows:
| English |
Japanese |

|

|
Smooth lines drawn by the default method are A. Data before and after It is calculated by.
The figure below shows a 5-day moving average with the option Local width at the bottom left set to "5". (In addition, Trim is set to the maximum.)
5-day moving average (A. Use the data before and after)

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

|

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

If Trim is set to a large value, the moving average will be from Day 5 to Day 16. From the graph, we can see that the number of recent customers is declining. Some measures may be necessary, such as conducting a campaign.
Show trends in the number of people infected with corona in Japan using a moving average
In Japan, there is a big difference in the number of inspections on weekdays and holidays, so there are many cases where we think on the "7-day average" because one week is 7 days. How to draw a 7-day moving average graph? Yes, B. Previous data only Will be used. The figure below is a graph showing the number of new corona infections by day in Japan, but the red curve is Trailing (forward section) It is a 7-day moving average drawn using the option of.

Curiously, even now in December, the number of newly infected coronaviruses in Japan is declining. 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.