Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
‘Simple’Univariate TimeSeriesMethods Dr. Geoffrey Ducanes UP School of Economics July 12 – Morning Sessions ‘Simple’ Univariate Time Series Methods • Moving Average Methods • Exponential Smoothing Methods • Trend Forecasting Methods Autoregressive Distributive Lag Models ‘Simple’ Univariate Time Series Methods • Simple: used to make quick forecasts (e.g. daily, weekly, or monthly production, sales, revenues, etc.) • ‘Easily’ implementable in a Worksheet Program, such as Excel • Uses only the historical values of the variable to be forecasted • Already allows analysts to distinguish between the basic underlying pattern in data (signal) and random fluctuations (noise) ‘Simple’ Univariate Time Series Methods • Method to be used depends on characteristics of data, whether • Stationary (use Moving Average or Single Exponential Smoothing) • With Linear Trend (use Double Moving Average or Double Exponential Smoothing) • With Seasonality and Trend (use Holt-Winters) Moving Average • Arithmetic mean of the n most recent observations • Equal weights assigned to each of the n data points • Analyst chooses number of periods (n) in a moving average • The smaller the number of observations in computing the moving average, the more weight is given to more recent periods. • The greater the number of observations in computing the moving average, the less weight is given to more recent periods. • Best suited to stationary data. Moving Average • 𝑦 ↓𝑡+1 =(𝑦↓𝑡 +𝑦↓𝑡−1 +𝑦↓𝑡−2 +…+𝑦↓𝑡 −𝑛+1 /𝑛 ) • where • 𝑦 ↓𝑡+1 = forecast value for next period • 𝑦↓𝑡 = actual value at time period t • n = number of terms in the moving average Example • Open file ‘Forecasting Simple Smoothing.xls’ Double Moving Average • Used when the time series data have a linear trend. Double Moving Average • 1stMA=𝑀𝐴↓𝑡 =(𝑦↓𝑡 +𝑦↓𝑡−1 +𝑦↓𝑡−2 +…+𝑦↓𝑡−𝑛+1 / 𝑛 ) • 2ndMA=𝑀𝐴↓𝑡 ′=(𝑀𝐴↓𝑡 +𝑀𝐴↓𝑡−1 +𝑀𝐴↓𝑡−2 +…+ 𝑀𝐴↓𝑡−𝑛+1 /𝑛 ) • 𝑎↓𝑡 =2𝑀𝐴↓𝑡 −𝑀𝐴↓𝑡 ’ • 𝑏↓𝑡 =2/𝑛−1 (𝑀𝐴↓𝑡 −𝑀𝐴↓𝑡 ’) • 𝑦 ↓𝑡+𝑥 =𝑎↓𝑡 +𝑏↓𝑡 x • where – 𝑦 ↓𝑡+𝑥 =forecastvalue – x=numberofperiodsaheadtobeforecast Example • Open file ‘Forecasting Simple Smoothing.xls’ Exponential Smoothing • Depends on three pieces of data – Most recent actual – Most recent forecast – Smoothing constant (𝛼) • If time series appears to evolve quite smoothly, give greater weight to more recent values • If time series quite erratic, less weight to most recent actual values is desirable Exponen8alSmoothing • 𝑦 ↓𝑡+1 =𝛼𝑦↓𝑡 +𝛼(1−𝛼)𝑦↓𝑡−1 +𝛼(1−𝛼)2𝑦↓𝑡−2 + 𝛼 (1−𝛼)3𝑦↓𝑡−3 …↓ • where – 𝑦 ↓𝑡+1 =newsmoothedvalueortheforecastvalueofthenextperiod – 𝛼=smoothingconstant – 𝑦↓𝑡 =actualvalueofseriesinperiodt • Notethatthisisatrueweightedaveragesince – 𝛼+𝛼(1−𝛼) +𝛼(1−𝛼)2+𝛼 (1−𝛼)3 +…=1 • 𝑦 ↓𝑡+1 =𝛼𝑦↓𝑡 +(1−𝛼) 𝑦 ↓𝑡 ↓ • Newes>mate=𝛼(Newdata)+(1−𝛼)(Previouses>mate) Example • Open file ‘Data Set Annualb.xls’ and import into Eviews • Double click on the variable ‘temp_ann’ so that the spreadsheet for the variable appears • [Verify that ‘temp_ann’ is stationary] • Select Proc on the button bar for that variable and then Exponential Smoothing followed by Simple Exponential Smoothing • Select Single and specify the estimation sample period as 1989 – 2010 • Give a name to the forecasted variable: e.g. temp_asm1 Double Exponential Smoothing • Used for forecasting data that have a linear trend • Requires less data than DMA and computationally more efficient. Double Exponential Smoothing • 𝑦 ↓𝑡+𝑥 =𝑎↓𝑡 +𝑏↓𝑡 𝑥↓ • where – 𝑦 ↓𝑡+𝑥 = forecast value x periods into the future – 𝑎 ↓𝑡 = the difference between the simple (A’) and the double (A’’) smoothed values – 𝑏↓𝑡 = an adjustment factor similar to a slope in a time series – x = number of periods ahead to be forecast • • • • 𝐴↓𝑡↑′ =𝛼𝑦↓𝑡 +(1−𝛼)𝐴↓𝑡−1↑′ 𝐴↓𝑡↑′′ =𝛼𝐴↓𝑡↑′ +(1−𝛼)𝐴↓𝑡−1↑′′ 𝑎↓𝑡 = 2𝐴↓𝑡↑′ −𝐴↓𝑡↑′′ 𝑏↓𝑡 =𝛼/1−𝛼 (𝐴↓𝑡↑′ −𝐴↓𝑡↑′′ ) Example • Again, use the file ‘Data Set Annualb’ • Double click on the variable ‘tot_elec_cons’ so that the spreadsheet for the variable appears • [Verify that ‘tot_elec_cons’ has an approximately linear trend] • Select Proc on the button bar for that variable and then Exponential Smoothing followed by Simple Exponential Smoothing • Select Double and specify the estimation sample period as 1989 – 2010 • Give a name to the forecasted variable: e.g. tot_elsm2 Holt-Winters’ Seasonal Exponential Smoothing • Allows for both trend and seasonal patterns of the data to be taken into account as the smoothing process is applied. • Seasonality can be specified as either additive or multiplicative Example • Open file ‘gdp sectoral quarterly.xls’ and import into Eviews • Double click on the variable ‘utilities’ so that the spreadsheet for the variable appears • [Verify that ‘utilities’ is seasonal apart from having a trend] • Select Proc on the button bar for that variable and then Exponential Smoothing followed by Simple Exponential Smoothing • Select Holt-Winters-Additive (or Holt-Winters-Multiplicative) and specify the estimation sample period as 1998q1 – 2014q4 • Give a name to the forecasted variable: e.g. utilsm3 Trend Forecasting • Modeling and forecasting a variable as a function of time or some transformation of time o t o ln(t) o exp(t) o t and t^2 • Choose model that leads to least systematic error Example • Use the file ‘Data Set Annualb’ • Model 1 o On the command window, type: smpl 1989 2009 ls gdp_val c @trend o On the equation dialog box, click on forecast. Check forecast graph, forecast evaluation, and Insert actual for out-of-sample observations and for forecast sample type 2010 2020 o Copy output and paste into Word o Click on View, then click on Actual, Fitted, Residual, then Actual, Fitted, Residual Graph o Copy output and paste into Word Example • Model 2 o On the command window, type: smpl 1989 2010 ls gdp_val c @trend @trend^2 o On the equation dialog box, click on forecast. Check forecast graph, forecast evaluation, and Insert actual for out-of-sample observations and for forecast sample type 2010 2020 o Copy output and paste into Word o Click on View, then click on Actual, Fitted, Residual, then Actual, Fitted, Residual Graph o Copy output and paste into Word • Compare results for Model 1 and Model 2 Exercise 1. Using observations only up to 2010, use Single Exponential Smoothing and Double Exponential Smoothing to forecast Commercial Electricity Consumption from 2011 to 2020. Which yields the more accurate forecast? (Data to be used: ‘Data Set Annualb’.) 2. Using observations only up to 2011q4, use Holt-WintersMultiplicative to forecast Manufacturing Value Added from 2012q1 to 2020q4. (Data to be used: ‘gdp sectoral quarterly’). 3. Using observations only from 1990 to 2010, use trend forecasting to forecast Total Electricity Consumption from 2011 to 2020. [Note that this requires choosing which the most appropriate trend function to use.] (Data to be used: ‘Data Set Annualb’.)