Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Time Series and Forecasting - Lecture Notes | MATH 241, Study notes of Mathematics

Material Type: Notes; Class: Statistical Applications; Subject: Mathematics; University: Saint Mary's College; Term: Spring 2009;

Typology: Study notes

Pre 2010

Uploaded on 08/05/2009

koofers-user-g2l
koofers-user-g2l 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Time Series and Forecasting
Atime seres is a set of observations {Yj}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
better) MSE = PYjˆ
Yj2
nwhere nis the number of observations used and ˆ
Yjis the value predicted by the method
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 nperiod moving average of a time series Yjis the average of nconsecutive
values.[with each new period, the oldest observation is dropped and the newest is include])
n-period moving average, through period k=
k
X
j=kn+1
Yj
n
The forecast for period i+ 1 is the moving average for the nperiods through time i.
Fi+1 = forecast for period i+ 1 = PYj
n, where Yj= actual value at time j, sum is taken over the nperiods
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 wjto each observation and calculate a weighted moving
average; then our forecast is
Fi+1 =PwjYj
Pwj
, with Yj= actual value at time j,wj= weight assigned to period j, sum is taken over the n
periods ending at period i.
Typically the weight is based on position in the last nobservations - 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+α(YiFi) = αYi+ (1 α)Fi
1
pf2

Partial preview of the text

Download Time Series and Forecasting - Lecture Notes | MATH 241 and more Study notes Mathematics in PDF only on Docsity!

Time Series and Forecasting

A time seres is a set of observations {Yj } 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

better) MSE =

Yj − Yˆj

n

where n is the number of observations used and Yˆj is the value predicted by the method

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])

n -period moving average, through period k =

∑^ k

j=k−n+

Yj

n

The forecast for period i + 1 is the moving average for the n periods through time i. Fi+1 = forecast for period i + 1 =

Yj n

, where Yj = actual value at time j, sum is taken over the n periods 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 Fi+1 =

wj Yj ∑ wj

, with Yj = actual value at time j, wj = weight assigned to period j, sum is taken over the n 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

(Some algebra shows that Fi+i = αYi + α(1 − α)Yi− 1 + α(1 − α)^2 Yi− 2 + · · · + α(1 − α)n−^1 Y 1 - the increasing exponents on the (1 − α) factor are the reason for the name “exponential”)

  1. 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 rising/falling at varying rates polynomial y = b 0 + b 1 t + b 2 t^2 + · · · + bntn

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).

  1. 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 (^) sum of the four averages^4 so that the average of the four values is 1. These four numbers are the 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 (^) sum of the 12 averages^12 to make the average of the indexes equal to 1.

  1. 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.