Home Gums Models for exponential smoothing and time series forecasting. Forecasting based on exponential smoothing

Models for exponential smoothing and time series forecasting. Forecasting based on exponential smoothing

1. Basic methodological provisions.

The simple exponential smoothing method uses a weighted (exponential) moving average of all data from previous observations. This model is most often applied to data in which it is necessary to assess the presence of a relationship between the analyzed indicators (trend) or the dependence of the analyzed data. The purpose of exponential smoothing is to estimate current state, the results of which will determine all subsequent forecasts.

Exponential smoothing provides Constant updating of the model using the latest data. This method is based on averaging (smoothing) time series of past observations in a descending (exponential) direction. That is, more recent events are given more weight. The weight is assigned as follows: for the last observation the weight will be α, for the penultimate one - (1-α), for the one that was before it - (1-α) 2, etc.

In a smoothed form, a new forecast (for time period t+1) can be represented as a weighted average of the last observation of a quantity at time t and its previous forecast for the same period t. Moreover, the weight α is assigned to the observed value, and the weight (1- α) is assigned to the forecast; it is assumed that 0< α<1. Это правило в общем виде можно записать следующим образом.

New forecast = [α*(last observation)]+[(1- α)*last forecast]

where is the predicted value at next period;

α – smoothing constant;

Y t – observation of value for current period t;

The previous smoothed forecast of this value for period t.

Exponential smoothing is a procedure for continually revising forecast results in light of the most recent events.

The smoothing constant α is a weighted factor. Its real value is determined by the extent to which the current observation should influence the predicted value. If α is close to 1, then the forecast significantly takes into account the magnitude of the error of the last forecast. Conversely, for small values ​​of α, the predicted value is closest to the previous forecast. Can be thought of as a weighted average of all past observations, with weights decreasing exponentially as the data ages.



Table 2.1

Comparison of the influence of different values ​​of smoothing constants

The constant α is the key to data analysis. If it is required that the predicted values ​​are stable and random deviations are smoothed out, it is necessary to choose a small value of α. A large value of the constant α makes sense if a quick response to changes in the spectrum of observations is needed.

2. A practical example of exponential smoothing.

The company's data on sales volume (thousand units) for seven years is presented, the smoothing constant is taken equal to 0.1 and 0.6. Data for 7 years constitute the test part; based on them, it is necessary to evaluate the effectiveness of each model. For exponential smoothing of series, the initial value is taken equal to 500 (the first value of the actual data or the average value for 3-5 periods is recorded in the smoothed value for the 2nd quarter).

Table 2.2

Initial data

Time Real value (actual) Smoothed value Forecast error
year quarter 0,1 0,1
Excel according to the formula
#N/A 0,00
500,00 -150,00
485,00 485,00 -235,00
461,50 461,50 -61,50
455,35 455,35 -5,35
454,82 454,82 -104,82
444,33 444,33 -244,33
419,90 419,90 -119,90
407,91 407,91 -57,91
402,12 402,12 -202,12
381,91 381,91 -231,91
358,72 358,72 41,28
362,84 362,84 187,16
381,56 381,56 -31,56
378,40 378,40 -128,40
365,56 365,56 184,44
384,01 384,01 165,99
400,61 400,61 -0,61
400,55 400,55 -50,55
395,49 395,49 204,51
415,94 415,94 334,06
449,35 449,35 50,65
454,41 454,41 -54,41
448,97 448,97 201,03
469,07 469,07 380,93

In Fig. Figure 2.1 presents a forecast based on exponential smoothing with a smoothing constant equal to 0.1.



Rice. 2.1. Exponential smoothing

Solution in Excel.

1. Select the menu “Tools” – “Data Analysis”. In the Analysis Tools list, select Exponential Smoothing. If there is no data analysis in the “Tools” menu, then you need to install the “Analysis Package”. To do this, find the “Settings” item in the “Options” and in the dialog box that appears, check the “Analysis package” box and click OK.

2. The dialog box shown in Fig. 1 will open on the screen. 2.2.

3. In the “input interval” field, enter the values ​​of the source data (plus one free cell).

4. Select the “labels” checkbox (if the input range contains column names).

5. Enter the value (1-α) in the “attenuation factor” field.

6. In the “input interval” field, enter the value of the cell in which you would like to see the resulting values.

7. Check the “Options” - “Graph output” checkbox to automatically build it.

Rice. 2.2. Dialog box for exponential smoothing

3. Laboratory work assignment.

There are initial data on the production volumes of an oil producing enterprise for 2 years, presented in Table 2.3:

Table 2.3

Initial data

Perform exponential smoothing of the series. Take the exponential smoothing coefficient equal to 0.1; 0.2; 0.3. Comment on the results obtained. You can use the statistics presented in Appendix 1.

Forecasting problems are based on changes in certain data over time (sales, demand, supplies, GDP, carbon emissions, population...) and projecting these changes into the future. Unfortunately, trends identified from historical data can be disrupted by many unforeseen circumstances. So data in the future may differ significantly from what happened in the past. This is the problem of forecasting.

However, there are techniques (called exponential smoothing) that allow you to not only try to predict the future, but also quantify the uncertainty of everything associated with the forecast. Numerically expressing uncertainty through the creation of forecast intervals is truly invaluable, but often overlooked in the forecasting world.

Download the note in or format, examples in format

Initial data

Let’s say you are a fan of “The Lord of the Rings” and have been making and selling swords for three years now (Fig. 1). Let's display sales graphically (Fig. 2). Demand has doubled in three years - maybe this is a trend? We'll come back to this idea a little later. The graph has several peaks and valleys, which may be a sign of seasonality. Specifically, the peaks occur in months numbered 12, 24 and 36, which happen to be December. But maybe this is just a coincidence? Let's find out.

Simple exponential smoothing

Exponential smoothing methods rely on predicting the future from data from the past, where newer observations weigh more heavily than older ones. This weighting is possible thanks to smoothing constants. The first exponential smoothing method we'll try is called simple exponential smoothing (SES). It uses only one smoothing constant.

Simple exponential smoothing assumes that your time series data consists of two components: a level (or average) and some error around that value. There is no trend or seasonal fluctuation - there is simply a level around which demand fluctuates, surrounded by small errors here and there. By giving preference to newer observations, TEC may cause shifts in this level. In the language of formulas,

Demand at time t = level + random error around the level at time t

So how do you find the approximate level value? If we accept all time values ​​as having the same value, then we should simply calculate their average value. However, this is a bad idea. More weight should be given to recent observations.

Let's create several levels. Let's calculate baseline in the first year:

level 0 = average demand for the first year (months 1-12)

For the demand for swords it is 163. We use level 0 (163) as the demand forecast for month 1. Demand for month 1 is 165, that is, it is 2 swords above level 0. It is worth updating the baseline approximation. The equation for simple exponential smoothing is:

level 1 = level 0 + a few percent × (demand 1 – level 0)

level 2 = level 1 + a few percent × (demand 2 – level 1)

Etc. “A few percent” is called the smoothing constant, and is denoted by alpha. This can be any number from 0 to 100% (0 to 1). You will learn how to choose the alpha value later. In general, the value for different times is:

Level current period = level previous period +
alpha × (demand current period – level previous period)

Future demand is equal to the last calculated level (Fig. 3). Since you don't know what alpha is, set cell C2 to 0.5 to start with. After the model is built, find an alpha such that the sum of squared error - E2 (or standard deviation - F2) is minimal. To do this, run the option Finding a solution. To do this, go through the menu DATA –> Finding a solution, and install in the window Solution Search Options required values ​​(Fig. 4). To display the forecast results on a chart, first select the range A6:B41 and build a simple line chart. Next, right-click on the diagram and select the option Select data. In the window that opens, create a second row and insert predictions from the range A42:B53 into it (Fig. 5).

Perhaps you have a trend

To check this assumption, it is enough to fit linear regression under the demand data and perform a t test on the rise of this trend line (as in ). If the slope of the line is non-zero and statistically significant (in testing using the Student’s t-test, the value R less than 0.05), the data has a trend (Fig. 6).

We used the LINEST function, which returns 10 descriptive statistics (if you have not used this function before, I recommend it) and the INDEX function, which allows you to “pull out” only the three required statistics, and not the entire set. It turned out that the slope is 2.54, and it is significant, since the Student's test showed that 0.000000012 is significantly less than 0.05. So, there is a trend, and all that remains is to include it in the forecast.

Holt Exponential Smoothing with Trend Adjustment

It is often called double exponential smoothing because it has not one smoothing parameter - alpha, but two. If a time sequence has a linear trend, then:

demand for time t = level + t × trend + random level deviation at time t

Holt Exponential Smoothing with Trend Adjustment has two new equations, one for the level as it moves through time, and the other for the trend. The level equation contains a smoothing parameter alpha, and the trend equation contains gamma. Here's what the new level equation looks like:

level 1 = level 0 + trend 0 + alpha × (demand 1 – (level 0 + trend 0))

note that level 0 + trend 0 is just a one-step forecast from initial values ​​to month 1, so demand 1 – (level 0 + trend 0)- this is a one-step deviation. Thus, the basic level approximation equation will be:

level current period = level previous period + trend previous period + alpha × (demand current period – (level previous period) + trend previous period))

Trend update equation:

trend current period = trend previous period + gamma × alpha × (demand current period – (level previous period) + trend previous period))

Holt smoothing in Excel is similar simple smoothing(Fig. 7), and as above, the goal is to find two coefficients by minimizing the sum of squared errors (Fig. 8). To get the initial level and trend values ​​(in cells C5 and D5 in Figure 7), plot a graph for the first 18 months of sales and add a trend line with an equation to it. Enter the initial trend value of 0.8369 and the initial level of 155.88 in cells C5 and D5. Forecast data can be presented graphically (Fig. 9).

Rice. 7. Holt exponential smoothing with trend adjustment; To enlarge the image, right-click on it and select Open image in new tab

Identifying patterns in data

There is a way to test the strength of a predictive model - compare the errors with themselves, shifted by a step (or several steps). If the deviations are random, then the model cannot be improved. However, there may be a seasonal factor in the demand data. The concept of an error term that is correlated with another period's version of itself is called autocorrelation (for more on autocorrelation, see ). To calculate autocorrelation, start with forecast error data for each period (column F in Figure 7 moves to column B in Figure 10). Next, define average error forecast (Fig. 10, cell B39; formula in cell: =AVERAGE(B3:B38)). In column C, calculate the deviation of the forecast error from the mean; formula in cell C3: =B3-B$39. Next, sequentially shift column C one column to the right and a row down. Formulas in cells D39: =SUMPRODUCT($C3:$C38,D3:D38), D41: =D39/$C39, D42: =2/SQRT(36), D43: =-2/SQRT(36).

What does it mean for one of the D:O columns to be “synchronous” with column C? For example, if columns C and D are synchronous, then a number that is negative in one of them must be negative in the other, positive in one, positive in friend. This means that the sum of the products of the two columns will be significant (the differences accumulate). Or, which is the same thing, than closer value in the range D41:O41 to zero, the lower the correlation of the column (from D to O, respectively) with column C (Fig. 11).

One autocorrelation higher critical value. The error shifted by a year correlates with itself. This means a 12 month seasonal cycle. And this is not surprising. If you look at the demand graph (Fig. 2), it turns out that there are peaks in demand every Christmas and troughs in April-May. Let's consider a forecasting technique that takes into account seasonality.

Holt-Winters multiplicative exponential smoothing

The method is called multiplicative (from multiplicate - multiply), because it uses multiplication to take into account seasonality:

Demand at time t = (level + t × trend) × seasonal adjustment for time t × any remaining irregular adjustments that we cannot account for

Holt-Winters smoothing is also called triple exponential smoothing because it has three smoothing parameters (alpha, gamma, and delta). For example, if there is a 12 month seasonal cycle:

Forecast for month 39 = (level 36 + 3 × trend 36) x seasonality 27

When analyzing data, it is necessary to find out what is a trend in a data series and what is seasonality. To perform calculations using the Holt-Winters method, you must:

  • Smooth historical data using the moving average method.
  • Compare a smoothed version of a time series of data with the original to get a rough estimate of seasonality.
  • Get new data without the seasonal component.
  • Find level and trend approximations based on this new data.

Start with the raw data (columns A and B in Figure 12) and add column C with the moving average smoothed values. Since seasonality has 12-month cycles, it makes sense to use a 12-month average. There is a slight problem with this average. 12 is an even number. If you smooth out month 7 demand, should you consider it to be the average demand from months 1 to 12 or from months 2 to 13? To overcome this difficulty, you need to smooth out demand using a “2x12 moving average.” That is, take half of the two averages from months 1 to 12 and from months 2 to 13. The formula in cell C8: =(AVERAGE(B3:B14)+AVERAGE(B2:B13))/2.

Smoothed data for months 1–6 and 31–36 cannot be obtained, since there are not enough previous and subsequent periods. For clarity, the original and smoothed data can be reflected in the diagram (Fig. 13).

Now in column D, divide the original value by the smoothed one and get the approximate seasonal adjustment value (column D in Fig. 12). The formula in cell D8 is =B8/C8. Note the spikes of 20% above normal demand in months 12 and 24 (December), while troughs are observed in the spring. This smoothing technique gave you two point estimates for each month (24 months in total). Column E finds the average of these two factors. Formula in cell E1: =AVERAGE(D14,D26). For clarity, the level of seasonal fluctuations can be presented graphically (Fig. 14).

Seasonally adjusted data can now be obtained. The formula in cell G1 is: =B2/E2. Construct a graph based on the data in column G, supplement it with a trend line, display the trend equation on the chart (Fig. 15), and use the coefficients in subsequent calculations.

Form a new sheet as shown in Fig. 16. Substitute the values ​​in the range E5:E16 from Fig. 12 areas E2:E13. Take the values ​​of C16 and D16 from the trend line equation in Fig. 15. Set the values ​​of the smoothing constants to start at 0.5. Stretch the values ​​in line 17 to cover the range of months 1 through 36. Run Finding a solution to optimize smoothing coefficients (Fig. 18). The formula in cell B53 is: =(C$52+(A53-A$52)*D$52)*E41.

Now you need to check the autocorrelations in the forecast made (Fig. 18). Since all the values ​​are located between the upper and lower boundaries, you understand that the model has done a good job of understanding the structure of demand values.

Constructing a confidence interval for the forecast

So, we have a completely working forecast. How do you set upper and lower bounds that can be used to make realistic assumptions? The Monte Carlo simulation that you have already encountered in (see also) will help you with this. The idea is to generate future scenarios of demand behavior and identify the group in which 95% of them fall.

Remove the forecast from cells B53:B64 from the Excel sheet (see Fig. 17). You will record the demand there based on the simulation. The latter can be generated using the NORMINV function. For future months, you just need to provide it with the mean (0), the standard distribution (10.37 from cell $H$2) and random number from 0 to 1. The function will return the deviation with a probability corresponding to a bell-shaped curve. Place the one-step error simulation in cell G53: =NORMIN(RAND(),0,H$2). Stretch this formula down to G64 and you get forecast error simulations for 12 months of a one-step forecast (Figure 19). Your simulation values ​​will differ from those shown in the figure (that’s why it’s a simulation!).

With forecast uncertainty, you have everything you need to update the level, trend and seasonal coefficient. So select cells C52:F52 and stretch them to row 64. As a result, you have a simulated forecast error and the forecast itself. Based on the opposite, we can predict demand values. Insert the formula into cell B53: =F53+G53 and stretch it to B64 (Fig. 20, range B53:F64). Now you can press the F9 button, updating the forecast each time. Place the results of 1000 simulations in cells A71:L1070, each time transposing the values ​​from the range B53:B64 to the range A71:L71, A72:L72, ... A1070:L1070. If this bothers you, write some VBA code.

Now you have 1000 scenarios for each month, and you can use the PERCENTILE function to get the upper and lower bounds at the middle of the 95% confidence interval. In cell A66 the formula is: =PERCENTILE(A71:A1070,0.975), and in cell A67: =PERCENTILE(A71:A1070,0.025).

As usual, for clarity, the data can be presented graphically (Fig. 21).

There are two interesting points in the graph:

  • The error becomes wider over time. It makes sense. Uncertainty accumulates with each passing month.
  • In the same way, the error increases in parts falling during periods of seasonal increase in demand. With its subsequent fall, the error shrinks.

Written based on the book by John Forman. – M.: Alpina Publisher, 2016. – P. 329–381

Exponential smoothing is a more complex weighted average method. Each new forecast is based on the previous forecast plus the percentage of the difference between that forecast and the actual value of the series at that point.

F t = F t -1 + (A t -1 - F t -1) (2)

Where: Ft – forecast for period t

F t -1– forecast for period t-1

– smoothing constant

A t - 1 – actual demand or sales for the period t-1

The smoothing constant is a percentage of the forecast error. Each new forecast is equal to the previous forecast plus a percentage of the previous error.

The sensitivity of forecast adjustment to error is determined by the smoothing constant; the closer its value is to 0, the slower the forecast will adapt to forecast errors (i.e., the greater the degree of smoothing). Conversely, the closer the value is to 1.0, the higher the sensitivity and the less smoothing.

The choice of smoothing constant is largely a matter of free choice or trial and error. The goal is to choose a smoothing constant such that, on the one hand, the forecast remains sufficiently sensitive to real changes in the time series data, and on the other hand, it smoothes out jumps caused by random factors well. Commonly used values ​​range from 0.05 to 0.50.

Exponential smoothing is one of the most widely used forecasting methods, partly because of its minimal data storage requirements and ease of calculation, and partly because of the ease with which the system of significance coefficients can be changed simply by changing the value of .

Table 3. Exponential smoothing

Period Actual demand α= 0.1 α = 0.4
forecast error forecast error
10 000 - - - -
11 200 10 000 11 200-10 000=1 200 10 000 11 200-10 000=1 200
11 500 10 000+0,1(11 200-10 000)=10 120 11 500-10 120=1 380 10 000+0,4(11 200-10 000)=10 480 11 500-10 480=1 020
13 200 10 120+0,1(11 500-10 120)=10 258 13 200-10 258=2 942 10 480+0,4(11 500-10 480)=10 888 13 200-10 888=2 312
14 500 10 258+0,1(13 200-10 258)=10 552 14 500-10 552=3 948 10 888+0,4(13 200-10 888)=11 813 14 500-11 813=2 687
- 10 552+0,1(14 500-10 552)=10 947 - 11 813+0,4(14 500-11 813)=12 888 -



Methods for trend

There are two important methods, which can be used to develop forecasts when a trend is present. One of them involves the use of a trend equation; another – extension of exponential smoothing.

Trend equation:

Linear equation trends look like this:

Y t = a + δ∙ t (3)

Where: t – definite number of periods from time to time t= 0;

Yt– period forecast t;

α - meaning Yt at t=0

δ – slope of the line.

Direct coefficients α And δ , can be calculated from statistical data for a certain period, using the following two equations:

δ= , (4)

α = , (5)

Where: n – number of periods,

y– time series value

Table 3. Trend level.

Period (t) Year Sales level (y) t∙y t 2
10 000 10 000
11 200 22 400
11 500 34 500
13 200 52 800
14 500 72 500
Total: - 60 400 192 200

Let's calculate the trend line coefficients:

δ=

So the trend line Y t = α + δ ∙ t

In our case, Y t = 43 900+1 100 ∙t,

Where t = 0 for period 0.

Let's create an equation for periods 6 (2015) and 7 (2016):

– forecast for 2015.

Y 7 = 43,900+1,100*7= 51,600

Let's build a graph:

Exponential smoothing of trends

A form of simple exponential smoothing can be used when the time series reveals a trend. This variation is called trending exponential smoothing or sometimes double smoothing. It differs from simple exponential smoothing, which is used only when the data varies around some average value or has abrupt or gradual changes.

If a series shows a trend and simple exponential smoothing is used, then all forecasts will lag the trend. For example, if the data increases, then each forecast will be underestimated. On the contrary, reducing the data gives an overestimated forecast. Graphically displaying the data can show when double smoothing would be preferable to single smoothing.

The trend-adjusted forecast (TAF) consists of two elements: a smoothed error and a trend factor.

TAF t +1 = S t + T t, (6)

Where: S t – smoothed forecast;

T t – assessment of the current trend

AND S t = TAF t + α 1 (A t - TAF t) , (7)

T t = T t-1 + α 2 (TAF t –TAF t-1 – T t-1) (8)

Where α 1, α 2– smoothing constants.

To use this method, you need to select the values ​​α 1, α 2 (by the usual selection) and make initial forecast and assessing trends.

Table 4. Exponential smoothing trend.

A simple and logically clear time series model looks like this:

Where b is a constant, and ε - random error. Constant b is relatively stable at each time interval, but can also change slowly over time. One of the intuitive ways to highlight meaning b of the data is to use moving average smoothing, in which the most recent observations are assigned greater weights than the penultimate ones, the penultimate ones more weights than the penultimate ones, etc. Simple exponential smoothing is designed exactly like this. Here, exponentially decreasing weights are assigned to older observations, and, unlike a moving average, all previous observations of the series are taken into account, and not just those that fell within a certain window. The exact formula for simple exponential smoothing is:

When this formula is applied recursively, each new smoothed value (which is also a forecast) is calculated as the weighted average of the current observation and the smoothed series. Obviously, the smoothing result depends on the parameter α . If α equals 1, then previous observations are completely ignored. If a is 0, then current observations are ignored. Values α between 0 and 1 give intermediate results. Empirical research showed that simple exponential smoothing often gives sufficient accurate forecast.

In practice it is usually recommended to take α less than 0.30. However, choosing a greater than 0.30 sometimes gives a more accurate prediction. This means that it is better to evaluate optimal value α based on real data rather than using general recommendations.

In practice, the optimal smoothing parameter is often found using a grid search procedure. The possible range of parameter values ​​is divided into a grid with a certain step. For example, consider a grid of values ​​from α =0.1 to α = 0.9 in increments of 0.1. Then this value is selected α , for which the sum of squares (or mean squares) of the residuals (observed values ​​minus step-forward predictions) is minimal.

Microsoft Excel has an Exponential Smoothing function, which is typically used to smooth the levels of an empirical time series based on the simple exponential smoothing method. To call this function, select the Tools - Data Analysis command on the menu bar. The Data Analysis window will open on the screen, in which you should select the Exponential smoothing value. As a result, a dialog box will appear Exponential smoothing, presented in Fig. 11.5.


In the Exponential Smoothing dialog box, almost the same parameters are set as in the Moving Average dialog box discussed above.

1. Input Range - the range of cells containing the values ​​of the parameter being studied is entered into this field.

2. Labels - this option checkbox is selected if the first row (column) in the input range contains a title. If there is no title, the checkbox should be cleared. In this case, standard names will be automatically created for the output range data.

3. Damping factor - the value of the selected exponential smoothing coefficient is entered in this field α . The default value is α = 0,3.

4. Output options - in this group, in addition to specifying the range of cells for the output data in the Output Range field, you can also request that the chart be automatically generated by checking the Chart Output option, and calculate standard errors by checking the Standard Errors option.

Let's use the function Exponential smoothing to re-solve the problem discussed above, but using the method of simple exponential smoothing. The selected values ​​of smoothing parameters are presented in Fig. 11.5. In Fig. 11.6 shows the calculated indicators, and Fig. 11.7 - constructed graphs.

Topic 3. Smoothing and forecasting of time series based on trend models

Purpose studying this topic is to create a basic basis for training managers in specialty 080507 in the field of model building various tasks in the field of economics, developing in students a systematic approach to setting and solving forecasting problems. The proposed course will allow specialists to quickly adapt to practical work, better navigate scientific and technical information and literature in their specialty, and be more confident in making decisions that arise in their work.

Main tasks studying the topic are: students obtain in-depth theoretical knowledge on the use of forecast models, acquire sustainable skills in performing research work, the ability to solve complex scientific problems associated with the construction of models, including multidimensional ones, the ability to logically analyze the results obtained and determine ways to find acceptable decisions.

Enough simple method identifying development trends is smoothing the time series, i.e. replacing actual levels with calculated ones that have smaller variations than the original data. The corresponding transformation is called filtering. Let's look at several smoothing methods.

3.1. Simple averages

The purpose of smoothing is to build a forecasting model for subsequent periods based on past observations. In the method of simple averages, the values ​​of the variable are taken as the initial data Y at moments in time t, and the forecast value is defined as a simple average for the next time period. Calculation formula looks like

Where n number of observations.

When a new observation becomes available, the newly obtained forecast should be taken into account when forecasting for the next period. When using this method, the forecast is made by averaging all previous data, however, the disadvantage of such forecasting is the difficulty of using it in trend models.

3.2. Moving average method

This method is based on representing a series as the sum of a fairly smooth trend and a random component. The method is based on the idea of ​​calculating a theoretical value based on a local approximation. To construct a trend estimate at a point t based on series values ​​from the time interval calculate the theoretical value of the series. The most widespread case in the practice of smoothing series is when all the weights for the elements of the interval are equal to each other. For this reason this method is called moving average method, since when performing the procedure, a window with a width of (2 m + 1) along the entire row. The window width is usually taken odd, since the theoretical value is calculated for central importance: number of terms k = 2m + 1 with the same number of levels to the left and right of the moment t.

The formula for calculating the moving average in this case takes the form:

The variance of the moving average is defined as σ 2 /k, where through σ 2 denotes the dispersion of the original terms of the series, and k smoothing interval, therefore, the larger the smoothing interval, the stronger the averaging of the data and the less variable the identified trend. Most often, smoothing is performed using three, five and seven members of the original series. In this case, the following features of the moving average should be taken into account: if we consider a series with periodic fluctuations of constant length, then when smoothing based on the moving average with a smoothing interval equal to or a multiple of the period, the fluctuations will be completely eliminated. Often, smoothing based on a moving average transforms the series so strongly that the identified development trend appears only in the most general outline, and smaller, but important for analysis details (waves, bends, etc.) disappear; after smoothing, small waves can sometimes change direction to the opposite “holes” appear in place of “peaks”, and vice versa. All this requires caution in the use of a simple moving average and forces us to look for more subtle methods of description.

The moving average method does not provide trend values ​​for the first and last m members of the series. This disadvantage is especially noticeable when the row length is short.

3.3. Exponential smoothing

Exponential average y t is an example of an asymmetric weighted moving average, which takes into account the degree of aging of the data: older information with less weight is included in the formula for calculating the smoothed value of the series level

Here — exponential average, replacing the observed value of the series y t(smoothing involves all data received to date t), α smoothing parameter characterizing the weight of the current (newest) observation; 0< α <1.

The method is used to forecast non-stationary time series with random changes in level and slope. As you move further into the past from the current moment in time, the weight of the corresponding member of the series quickly (exponentially) decreases and practically ceases to have any effect on the value.

It is easy to obtain that the last relation allows us to give the following interpretation of the exponential average: if — series value forecast y t, then the difference is the forecast error. Thus, the forecast for the next point in time t+1 takes into account what became known at the moment t forecast error.

Smoothing parameter α is a weighing factor. If α is close to unity, then the forecast significantly takes into account the magnitude of the error of the last forecast. At small values α the predicted value is close to the previous forecast. Choosing a smoothing parameter is a rather complex problem. General considerations are as follows: the method is good for predicting fairly smooth series. In this case, you can choose a smoothing constant by minimizing the one-step ahead forecast error estimated from the last third of the series. Some experts do not recommend using large values ​​of the smoothing parameter. In Fig. Figure 3.1 shows an example of a smoothed series using the exponential smoothing method with α= 0,1.

Rice. 3.1. The result of exponential smoothing at α =0,1
(1 original series; 2 smoothed series; 3 remainders)

3.4. Exponential smoothing
taking into account the trend (Holt method)

This method takes into account the local linear trend present in the time series. If there is an upward trend in the time series, then along with an assessment of the current level, an assessment of the slope is also necessary. In the Holt technique, the level and slope values ​​are smoothed directly by using different constants for each parameter. Constant smoothing allows you to estimate the current level and slope, refining them whenever new observations appear.

The Holt method uses three calculation formulas:

  1. Exponentially smoothed series (current level estimate)

(3.2)

  1. Trend assessment

(3.3)

  1. Forecast for R periods ahead

(3.4)

Where α, β smoothing constants from the interval.

Equation (3.2) is similar to equation (3.1) for simple exponential smoothing except for the trend term. Constant β needed to smooth the trend estimate. In the forecast equation (3.3), the trend estimate is multiplied by the number of periods R, on which the forecast is based, and then this product is added to the current level of smoothed data.

Permanent α And β are selected subjectively or by minimizing the prediction error. The larger the weights are taken, the faster the response to changes will occur and the more smooth the data will be. Smaller weights make the structure of the smoothed values ​​less smooth.

In Fig. 3.2 shows an example of smoothing a series using the Holt method with values α And β , equal to 0.1.

Rice. 3.2. The result of smoothing using the Holt method
at α = 0,1 And β = 0,1

3.5. Exponential smoothing taking into account trend and seasonal variations (Winters method)

When there are seasonal variations in the data structure, a three-parameter exponential smoothing model proposed by Winters is used to reduce forecast errors. This approach is an extension of Holt's previous model. To account for seasonal variations, an additional equation is used here, and this method is completely described by four equations:

  1. Exponentially smoothed series

(3.5)

  1. Trend assessment

(3.6)

  1. Seasonality assessment

.

(3.7)

  1. Forecast for R periods ahead

(3.8)

Where α, β, γ constant smoothing for level, trend and seasonality, respectively; s- duration of the seasonal fluctuation period.

Equation (3.5) corrects the smoothed series. The term in this equation takes into account seasonality in the source data. After taking into account seasonality and trend in equations (3.6), (3.7), the estimates are smoothed, and a forecast is made in equation (3.8).

Same as in the previous method, the weights α, β, γ can be selected subjectively or by minimizing prediction error. Before applying equation (3.5), it is necessary to determine the initial values ​​for the smoothed series Lt, trend T t, seasonality coefficients S t. Typically, the initial value of the smoothed series is taken equal to the first observation, then the trend is equal to zero, and the seasonality coefficients are set equal to one.

In Fig. Figure 3.3 shows an example of smoothing a series using the Winters method.

Rice. 3.3. The result of smoothing using the Winters method
at α = 0,1 = 0.1; γ = 0.1(1 - original series; 2 smoothed series; 3 remainders)

3.6. Forecasting based on trend models

Quite often, time series have a linear trend (trend). Assuming a linear trend, it is necessary to construct a straight line that would most accurately reflect the change in dynamics over the period under consideration. There are several methods for constructing a straight line, but the most objective from a formal point of view will be the construction based on minimizing the sum of negative and positive deviations of the initial values ​​of the series from the straight line.

A straight line in a two-coordinate system (x,y) can be determined by the intersection point of one of the coordinates at and angle of inclination to the axis X. The equation of such a line will look like Where a- intersection point; b tilt angle.

In order for a straight line to reflect the course of dynamics, it is necessary to minimize the sum of vertical deviations. When using a simple sum of deviations as a criterion for assessing minimization, the result will not be very good, since negative and positive deviations mutually compensate each other. Minimizing the sum of absolute values ​​also does not lead to satisfactory results, since parameter estimates in this case are unstable, and there are also computational difficulties in implementing such an estimation procedure. Therefore, the most commonly used procedure is to minimize the sum of squared deviations or least square method(MNC).

Since the series of initial values ​​has fluctuations, the model of the series will contain errors, the squares of which must be minimized

where y i observed value; y i * theoretical values ​​of the model; observation number.

When modeling the trend of the original time series using a linear trend, we assume that

Dividing the first equation by n, we come to the next

Substituting the resulting expression into the second equation of system (3.10), for the coefficient b* we get:

3.7. Checking model fit

As an example in Fig. 3.4 shows a linear regression graph between car power X and its cost at.

Rice. 3.4. Linear Regression Plot

The equation for this case is: at=1455,3 + 13,4 X. Visual analysis of this figure shows that for a number of observations there are significant deviations from the theoretical curve. The residual plot is shown in Fig. 3.5.

Rice. 3.5. Balance chart

Analysis of the regression line residuals can provide a useful measure of how well the estimated regression reflects the actual data. A good regression is one that explains a significant portion of the variance and, conversely, a bad regression does not track a large amount of variation in the original data. It is intuitively clear that any additional information will improve the model, i.e., reduce the unexplained portion of the variation in the variable at. To analyze the regression, we will decompose the variance into components. It's obvious that

The last term will be equal to zero, since it represents the sum of the remainders, so we come to the following result

Where SS 0, SS 1, SS 2 determine the total, regression and residual sums of squares, respectively.

The regression sum of squares measures the portion of variance explained by a linear relationship; residual part of the variance that is not explained by a linear relationship.

Each of these sums is characterized by a corresponding number of degrees of freedom (DOF), which determines the number of data units independent of each other. In other words, heart rate is related to the number of observations n and the number of parameters calculated from the totality of data. In the case under consideration, to calculate SS 0 only one constant is determined (the average value), therefore the heart rate for SS 0 will be (n1), Heart rate for SS 2 – (n – 2) and heart rate for SS 1 will be n – (n – 1)=1, since there are n – 1 constant points in the regression equation. Just like sums of squares, heart rates are related by the relation

The sums of squares associated with the variance decomposition, together with the corresponding HRs, can be placed in the so-called analysis of variance table (ANOVA table ANalysis Of VAriance) (Table 3.1).

Table 3.1

ANOVA table

Source

Sum of squares

Middle square

Regression

SS 2/(n-2)

Using the introduced abbreviation for sums of squares, we define coefficient of determination as the ratio of the sum of squares of the regression to the total sum of squares in the form

(3.13)

The coefficient of determination measures the proportion of variability of a variable Y, which can be explained using information about the variability of the independent variable X. The coefficient of determination changes from zero when X does not affect Y, to one when the change Y fully explained by the change X.

3.8. Regression forecast model

The best forecast is the one with the minimum variance. In our case, ordinary OLS produces the best forecast of all methods that produce unbiased estimates based on linear equations. The forecast error associated with the forecasting procedure can come from four sources.

First, the random nature of the additive errors handled by linear regression ensures that the forecast will deviate from the true values ​​even if the model is correctly specified and its parameters are precisely known.

Secondly, the estimation process itself introduces error into the estimation of parameters; they can rarely be equal to the true values, although they are equal to them on average.

Thirdly, in the case of a conditional forecast (in the case of precisely unknown values ​​of the independent variables), an error is introduced with the forecast of the explanatory variables.

Fourth, an error may occur because the model specification is inaccurate.

As a result, the sources of error can be classified as follows:

  1. nature of the variable;
  2. nature of the model;
  3. error introduced by the forecast of independent random variables;
  4. specification error.

We will consider an unconditional forecast, when the independent variables are easily and accurately predicted. Let's start considering the problem of forecast quality with the paired regression equation.

The problem statement in this case can be formulated as follows: what will be the best forecast y T+1, provided that in the model y = a + bx options A And b are estimated accurately, and the value x T+1 known.

Then the predicted value can be defined as

The forecast error will be

.

The forecast error has two properties:

The resulting variance is minimal among all possible estimates based on linear equations.

Although A and b are known, the forecast error appears due to the fact that at T+1 may not lie on the regression line due to error ε T+1, subject to a normal distribution with zero mean and variance σ 2. To check the quality of the forecast, we introduce a normalized value

Then you can define the 95% confidence interval as follows:

Where β 0.05 quantiles of normal distribution.

The boundaries of the 95% interval can be defined as

Note that in this case the width confidence interval does not depend on size X, and the boundaries of the interval are straight lines parallel to the regression line.

More often, when constructing a regression line and checking the quality of the forecast, it is necessary to evaluate not only the regression parameters, but also the variance of the forecast error. It can be shown that in this case the error variance depends on the value (), where is the average value of the independent variable. In addition, the longer the series, the more accurate the forecast. The forecast error decreases if the value of X T+1 is close to the average value of the independent variable, and, conversely, when moving away from the average value, the forecast becomes less accurate. In Fig. Figure 3.6 shows the results of the forecast using a linear regression equation for 6 time intervals ahead along with confidence intervals.

Rice. 3.6. Forecast by linear regression equation

As can be seen from Fig. 3.6, this regression line does not describe the original data well enough: there is a large variation relative to the fitting line. The quality of the model can also be judged by the residuals, which, if the model is satisfactory, should be distributed approximately according to the normal law. In Fig. Figure 3.7 shows a graph of residuals constructed using a probability scale.

Fig.3.7. Balance chart

When using such a scale, data that obeys the normal law must lie on a straight line. As follows from the above figure, the points at the beginning and end of the observation period deviate somewhat from the straight line, which indicates that the selected model in the form of a linear regression equation is not of sufficiently high quality.

In table Table 3.2 shows the forecast results (second column) along with 95% confidence intervals (lower third and upper fourth columns, respectively).

Table 3.2

Forecast results

3.9. Multivariate regression model

In multivariate regression, the data for each case includes the values ​​of the dependent variable and each independent variable. Dependent Variable y this is a random variable related to the independent variables by the following relationship:

where regression coefficients to be determined; ε error component corresponding to the deviation of the values ​​of the dependent variable from the true relationship (it is assumed that the errors are independent and have a normal distribution with zero mathematical expectation and unknown variance σ ).

For a given data set, estimates of the regression coefficients can be found using OLS. If OLS estimates are denoted by , then the corresponding regression function will have the form:

The residuals are estimates of the error component and are similar to the residuals in the case of simple linear regression.

Statistical analysis of a multivariate regression model is carried out similarly to simple linear regression analysis. Standard statistical software packages make it possible to obtain OLS estimates for model parameters and estimates of their standard errors. Alternatively, you can get the value t-statistics to check the significance of individual terms of the regression model and the value F-statistics to check the significance of the regression dependence.

The form of partitioning sums of squares in the case of multivariate regression is similar to expression (3.13), but the relationship for heart rate will be as follows

Let us emphasize once again that n represents the volume of observations, and k number of variables in the model. The total variation of a dependent variable consists of two components: the variation explained by the independent variables through the regression function, and the unexplained variation.

The ANOVA table for the case of multivariate regression will have the form shown in table. 3.3.

Table 3.3

ANOVA table

Source

Sum of squares

Middle square

Regression

SS 2/(n-k-1)

As an example of multivariate regression, we will use data from the Statistica package (data file Poverty.Sta) The data presented is based on a comparison of the 1960 and 1970 census results. for a random sample of 30 countries. The country names were entered as string names, and the names of all the variables in this file are given below:

POP_CHNG population change for 1960-1970;

N_EMPLD number of people employed in agriculture;

PT_POOR percentage of families living below the poverty level;

TAX_RATE tax rate;

PT_PHONE percentage of apartments with a telephone;

PT_RURAL percentage of rural population;

AGE middle age.

As a dependent variable we choose the sign Pt_Poor, and as independent - all the rest. The calculated regression coefficients between the selected variables are given in Table. 3.4

Table 3.4

Regression coefficients

This table shows the regression coefficients ( IN) and standardized regression coefficients ( Beta). Using coefficients IN the form of the regression equation is established, which in this case has the form:

The inclusion of only these variables on the right side is due to the fact that only these signs have a probability value R less than 0.05 (see fourth column of Table 3.4).

Bibliography

  1. Basovsky L. E. Forecasting and planning in market conditions. – M.: Infra - M, 2003.
  2. Box J., Jenkins G. Time series analysis. Issue 1. Forecast and management. – M.: Mir, 1974.
  3. Borovikov V. P., Ivchenko G. I. Forecasting in the Statistica system in the Windows environment. – M.: Finance and Statistics, 1999.
  4. Duke V. Data processing on a PC in examples. – St. Petersburg: Peter, 1997.
  5. Ivchenko B. P., Martyshchenko L. A., Ivantsov I. B. Information microeconomics. Part 1. Methods of analysis and forecasting. – St. Petersburg: Nordmed-Izdat, 1997.
  6. Krichevsky M. L. Introduction to artificial neural networks: Textbook. allowance. – SPb.: SPb. state marine tech. University, 1999.
  7. Soshnikova L. A., Tamashevich V. N., Uebe G. et al. Multivariate statistical analysis in economics. – M.: Unity-Dana, 1999.


New on the site

>

Most popular