Moving Average (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_EN/sdk.js#xfbml=1&version=v2.3&appId="; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));

Moderator: mindphp

numtan5839
PHP VIP Members
Posts: 1706
Joined: 04/11/2019 10:18 am

Moving Average

Moving Average Is the calculation of the average of data according to the specified time period.
so, we can set duration and data we need for calculation.
Moving Average method Is not the same as an Arithmetic mean method.
forasmuch don't use all data to add together and calculate the average.
but, we will use historical data at equal intervals for calculation.

Average1.png (62.73 KiB) Viewed 248 times

We will often see that is the calculation of product sales in the next month. By using data from previous month to calculate.
or many people may call this the method of forecasting.

How to calculate moving average

The formula used for Moving Average

The sum of data in each month / The number of months that the data has been used

so, we will calculate the sales for August. we will use sales of previous month.

January sold 100,000 baht
February sold 120,000 baht
March sold 130,000 baht
April sold 100,000 baht
May sold 150,000 baht
June sold 140,000 baht
July sold 130,000 baht

we will calculate moving average 4 months. so, we will calculate the sales for August.
we will use sales of previous month is April, May, June, July.
Moving Average = (100,000 + 150,000 + 140,000 + 130,000) / 4
Moving Average = 130,000
Estimated sales for August is 130,000 baht.

References