Time Series and Forecasting a Time Seres Is a Set of Observations {Y J}
Total Page:16
File Type:pdf, Size:1020Kb
Time Series and Forecasting A time seres is a set of observations fYjg of some variable taken at regular time intervals (monthly, quarterly, yearly, etc.). Forecasting refers to using past experience to predict values for the future, which requires summarizing the past experience in some useful way, based on the behavior that is expected to continue and factoring out random variation. The ultimate test of a forecasting method can only be carried out after the time predicted { not very helpful when the prediction is needed { so our comparisons of various methods rely on \How well would this method (if it had been used) have predicted what we (now) know really happened?". Thus we use \prediction error" (exactly the same idea as residu- als in regression) for past time periods and the mean of the squares of the errors to compare the success of different methods. Our methods break down (broadly) into two groups 1.) Smoothing methods: the simplest description and prediction with no assumption about patterns. For forecasting, these methods are appropriate only for forecasting one period (one month for monthly data, one year for yearly data, etc.) into the future 2.) Classical time series: Certain patterns (seasonal variation, underlying trend) are identified and separated out (using the methods developed for group 1 as well as regression techniques) to give a more complete representation. This requires assumptions about the existence of patterns but then allows forecasting behavior for several time periods. Because there is no unifying assumption of pattern (as there is with linear regression), there is no \best fit” prediction and no tests of significance are used { these are very much descriptive techniques being used to make forecasts. Compar- ison of results is on a case-by-case basis and based on the mean square error of the predictions of past behavior. Accuracy of a method over a particular part of the series is measured by the mean square error MSE (smaller is P 2 Yj − Y^j better) MSE = where n is the number of observations used and Y^ is the value predicted by the method n j for time j. [Some people call this \mean square deviation" { abbreviated MSD]. 1. Smoothing: (a) Moving averages To summarize behavior in a time series, our first (and most basic) tool is the moving average used to smooth out the series for forecasting. The n period moving average of a time series Yj is the average of n consecutive values.[with each new period, the oldest observation is dropped and the newest is include]) k X Yj j=k−n+1 n -period moving average, through period k = n The forecast for period i + 1 is the moving average for the n periods through time i. P Y F = forecast for period i + 1 = j , where Y = actual value at time j, sum is taken over the n periods i+1 n j ending at period i) In using a moving average for forecasting, the main issue is the number of observations to include in the moving average. (b) Weighted moving averages To treat different observations as more useful or less useful (we are likely to consider more recent observations as more useful for forecasting) we assign a weight wj to each observation and calculate a weighted moving average; then our forecast is P wjYj Fi+1 = P , with Yj = actual value at time j, wj = weight assigned to period j, sum is taken over the n wj periods ending at period i. Typically the weight is based on position in the last n observations - so the same observation has different weights depending on which moving average we are calculating. (c) Exponential smoothing This forecasting method gives a prediction based on a weighted average of the most recent observation (Yi) and the prediction for that value (Fi) (which uses the previous observed values). The effect is a weighted average, with more history [more periods included] in each prediction, but weighting the older data less and less heavily as time goes on. It involves a single weighting factor α which is less than one. Fi+1 = Fi + α(Yi − Fi) = αYi + (1 − α)Fi 1 2 n−1 (Some algebra shows that Fi+i = αYi + α(1 − α)Yi−1 + α(1 − α) Yi−2 + ··· + α(1 − α) Y1 - the increasing exponents on the (1 − α) factor are the reason for the name \exponential") 2. Trend analysis To look for an overall pattern for the \center" of the values, with random variation around this pattern, we speak of a \trend" in the data. The simplest form is linear trend | and we would use our linear regression model (with time as predictor) to model the trend. Other types of trend models are also used, depending on the expected pattern of the trend: shape name trend formula other forms rising or falling at steady rate linear y = a + bt rising at increasing rate exponential y = abt log(y) = log(a) + log(b)t falling at decreasing rate exponential y = abt(b < 1) log(y) = log(a) + log(b)t 2 n rising/falling at varying rates polynomial y = b0 + b1t + b2t + ··· + bnt We shall not work with trends other than the linear { more advanced regression methods (really linear regression with some add-ons and other considerations) are used to find trend equations of the other forms. Choosing among the types is again based on comparison of mean square error (with the usual reluctance to use too many predictors). 3. Seasonal indexes A seasonal index St represents the percentage change in values (from baseline) due to seasonal influences. The most common method of finding seasonal indexes is through the method of centered moving averages (moving average centered on the period of interest rather than ending at the period). To calculate seasonal index (described as calculation for one quarter) (a) For each quarter of each year calculate i. The four-quarter moving average centered at the middle of the quarter. ii. The seasonal irregular value for that quarter { the actual value (Yj) for the quarter divided by the centered moving average for that quarter (b) For each quarter (1, 2, 3, 4) take the average (text uses mean, many others | and Minitab | use median) of all the seasonal irregular values for those quarters in the years observed. If necessary, multiply each of the averages by 4 so that the average of the four values is 1. These four numbers are the sum of the four averages Seasonal indexes. To deseasonalize a time series (remove the{average{seasonal effects from the series) we divide each quarterly ob- servation by the Seasonal Index for that quarter. [This results in the \seasonally adjusted" figures often heard in reports of unemployment figures, retail sales figures, etc.] NOTE: To use monthly indexes, we would use the same procedure with twelve-month moving averages centered on the months, calculate Seasonal irregulars (they would be \monthly")for each month, and multiply each monthly average by 12 to make the average of the indexes equal to 1. sum of the 12 averages 4. Classical time series analysis The classic multiplicative model represents the series by Yt = Tt × St × Ct × It T = TREND = long range general movement of Y over an extended period of time. It can be estimated by a scatterplot, however, it is usually found by regression analysis. S = SEASONAL FLUCTUATION = regularly occurring patterns of Y, usually on an annual (whole cycle runs one year) basis. C = CYCLIC MOVEMENT = wide swings from the trend of a year or more in duration (due to the \business cycle" { including recessions, booms, etc.) . I = IRREGULAR MOVEMENT = all variation that cannot be explained by the above three factors (white noise) (random factors - analogous to the error term in the regression model representing deviation from the \patterned" part, but this is multiplied rather than added). Because the Cyclic movement is so hard to estimate and the irregular movement is impossible to model, we will work mainly with the model Y = T ×S recognizing that this, like the regression model, represents the basic behavior around which the random variation occurs. To estimate such a model, we generally calculate seasonal indexes first (this will, of course, require several years of data) and calculate a trend using regression on the deseasonalized data. We do not obtain confidence intervals or significance levels for our model. 2.