230 likes | 312 Views
Lecture: Intro to Forecasting. April 2, 2014. Question. What is your primary personal computing platform? Mac Windows I have and use both a Mac and PC Other ( eg , Linux/Unix/BSD) I don’t have a personal computer. I only use the lab machines. Administrative.
E N D
Lecture:Intro to Forecasting April 2, 2014
Question • What is your primary personal computing platform? • Mac • Windows • I have and use both a Mac and PC • Other (eg, Linux/Unix/BSD) • I don’t have a personal computer. I only use the lab machines.
Administrative • Problem set 8: posted soon, due next Wednesday • Final quiz (quiz 5): 1 week from this coming Monday (14/4) • Exam 3: 2 weeks from this coming Monday (21/4) • Final exam: 3 weeks from this coming Monday (28/4) • Yikes!
Time Series • Many business related data analysis problems relate to predicting future amounts (sales, costs, prices, etc.) • The key think about time series is that there is an explicit order in the data that we can exploit: time. • We’ve already touched on time series analysis but now we’ll examine it more in depth. • The book touches on it briefly, but not enough. Two scanned readings on my website under /Readings: • Smoothing methods (today/next time) • Time Series (next time)
Decomposing a Time Series Now we’ll often look and think about the “x-axis” as time: • Forecast: prediction of a future value of a time series that extrapolates from historical patterns
Decomposing a Time Series • Unfortunately different people use slightly different terminology • Cyclical patterns:
Decomposing a Time Series • Seasonality:
Decomposing a Time Series • Components: • Trend: estimated linear pattern • Seasonal: regular “up and down” oscillations related to the calendar. Most commonly seasonal patterns that are the same or similar from year to year. • Irregular: irregular variation. Assumed to be random error.
Smoothing • Smoothing: • Removing irregular and seasonal components of a time series to enhance the visibility of a trend. Can visually helpful but can also be misleading.
Seasonality • Seasonally Adjusted • Removing the seasonal component of a time series • Many economic and gov’t reports are seasonally adjusted.
Moving Averages • Moving Average: A (sometimes weighted) average of adjacent values of a time series • More terms that are averaged, the smoother the estimate. • Centered moving average with a span=5
Moving Averages • Moving Average: A (sometimes weighted) average of adjacent values of a time series • More terms that are averaged, the smoother the estimate. • Centered moving average with a span=5 but in Finance (and much of the business world) it’s more common to only use the previous observationsto calculate the moving average: span = 5
Question • Using a moving average with a span of 3, forecast the closing price of the SPY on 4-Feb-14 • 178.25 • 177.19 • 177.6 • I have no idea
Example • Time series plots in StatTools • Moving average with varying span amounts
Measures of Performance There are several common measures of a forecast model’s accuracy:
Question • What is the MAPE of moving average forecast with a span of 5 using the New Orders dataset? • 14.5% • 9.7% • 13.6% • 12.2%
Exponential Smoothing • EWMA: Exponentially Weighted Moving Averages. • The book refers to as weights: wt • I’ll refer to αt = (1 – wt) • This is how StatTools refers to them • As previously mention there are some differences in notion depending on field, etc… • It is no different – just a slight change in notation to help you with using StatTools
Exponential Smoothing We’ll talk about 3 types of exponential smoothing: • Simple: appropriate for a series with no pronounced trend or seasonality • Holt’s method: appropriate for a series with a trend but no seasonality. Not in the book, but scanned reading. • Winters’ method: for a series with seasonality (and possible trend). Again, not in the book
Simple Exp Smoothing • We’ll refer to the level of a series at time t as Lt for a given smoothing constant α: • A the future forecast for any time t+k • Note • Levels are defined recursively • All future forecasts are just the last level (or smoothed) value.
Simple Exp Smoothing • From the previous equations it follows that the predicted level at any time t is just a function of the previous observed amounts: • What value of α should you use? • Eh… hard to stay. 0.1? 0.2? • Lower is smoother. (the weights in the book w, are 1-α and hence larger w produce smoother forecasts). • You can let StatTools optimize α to minimize RSME • Keep in mind that this could run the risk of overfitting your data
Holt’s Method • If there is an obvious trend in the data, the simple exponential method doesn’t always do that well. A second method is due to Holt: Where Tt is the trend term at time t with a trend smoothing constant
Question • What is the RMSE of a exponential smoothed forecast using Holt’s method with α=β=.2? (new_orders.xls) • 3.764 • 4.515 • 4.428 • 4.48
Next time • Seasonally adjusting data • In practice, we usually don’t do it by hand but it’s important to know what’s going on • Later, we’ll leave the data and model seasonality directly • Winters’ method to smooth and adjust for seasonality. • Polynomial regressions