Download presentation
Presentation is loading. Please wait.
Published byBonnie Lawrence Modified over 8 years ago
1
Statistics for Business and Economics Module 2: Regression and time series analysis Spring 2010 Lecture 7: Time Series Analysis and Forecasting 1 Priyantha Wijayatunga, Department of Statistics, Umeå University priyantha.wijayatunga@stat.umu.se These materials are altered ones from copyrighted lecture slides (© 2009 W.H. Freeman and Company) from the homepage of the book: The Practice of Business Statistics Using Data for Decisions :Second Edition by Moore, McCabe, Duckworth and Alwan.
2
Trend and seasonality in Time series models Reference to the book: Chapter 13.1 Identifying trends Seasonal patterns: additive models and multiplicative models
3
Introduction Measurements of a variable taken at regular intervals over time form a time series. A time plot of a variable plots each observation against the time at which it was measured. Time is marked on the horizontal scale, and the variable of interest is marked on the vertical scale. Connecting sequential data points by lines helps emphasize changes over time. We analyze time series to detect patterns. The patterns helps to predict the future Examples: monthly product demand, daily stock prices. A trend in a time series is a persistent, long-term rise or fall. A pattern in a time series that repeats itself at known regular intervals of time is called seasonal variation.
4
Example Export for Sweden in the years 1993 -2004 Source:(www.scb.se)
5
Multiple regression Time series analysis X 1t Y t X 2t Y t …. X kt Observations coming at the same observations with time order time or time is not important (time is important) Earlier values of Y
6
Components of a Time Series A time series can consist of four components. Long - term trend (T). Cyclical effect (C). Seasonal effect (S). Random variation (R).
7
A trend is a long term relatively smooth pattern or direction, that persists usually for more than one year.
8
A cycle is a wavelike pattern describing a long term behavior (for more than one year). Cycles are seldom regular, and often appear in combination with other components. 6/90 6/93 6/96 6/99 6/02
9
Components of a Time Series The seasonal component of the time series exhibits a short term (one calendar year) repetitive behavior. 6/97 12/97 6/98 12/98 6/99
10
We try to remove random variation thereby, identify the other components. Random variation comprises the irregular unpredictable changes in the time series. It tends to hide the other (more predictable) components.
11
Another example The gradual increase in overall sales is an example of a trend. The repeating pattern is an example of yearly seasonal variation. No visible other cyclic variation Random variation is there but hard to see A prediction of a future value of a time series is called a forecast. Time plot of U.S. retail sales of general merchandise stores for each month from January 1992 to May 2002.
12
Identifying trends We estimate the linear trend to be: predicted SALES = 18,736 + 145.5 x Where x = number of months elapsed beginning with the first month of the time series. R 2 = 0.429 for this model. The trend line ignores seasonal variation in the retail sales. Using the equation above to forecast sales for say, December 2002, will result in a gross underestimate. Trend line (black) fitted to U.S. retail sales of general merchandise stores using simple linear regression.
13
Identifying trends Exponential trend (black) fitted to the number of DVD players sold Trends in time series may be described by a curved model like a polynomial. Maybe the second order polynomial model Number_of_units = b 0 + b 1 (time) + b 2 (time) 2 OR Number_of_units = a x e b x (time) The time plot above illustrates another type of curved relationship - an exponential trend.
14
Additive Models Sometimes it may be reasonble to think y = TREND + SEASONALITY By this we mean that time series has a general trend but has a seasonal variation that is described by adding a seasonal factor Then we can use standard regression techniques to model the series
15
Additive model of seasonal patterns We can use indicator variables to add the seasonal pattern in a time series to a trend model. Example: The seasonal pattern in the monthly retail sales data seems to repeat every 12 months, so we begin by creating 12-1 = 11 indicator variables. X1 = 1 if the month is January, 0 otherwise X2 = 1 if the month is February, 0 otherwise … and so on … X11 = 1 if the month is November, 0 otherwise (December data are indicated when all 11 indicator variables are 0) We can extend the trend model with these indicator variables. SALES = 0 + 1 x + 2 X1 +… + 12 X11 + Є This is the trend-and-season model.
16
Trend-and-season model (black) fitted to U.S. retail sales of general merchandise stores. R 2 = 0.987 for this model. Trend line (black) fitted to U.S. retail sales of general merchandise stores using simple linear regression. R 2 = 0.429 for this model.
17
Multiplicative Models Sometimes it may be reasonble to think y = TREND x SEASONALITY By this we mean that time series has a general trend but has a seasonal variation that is described by multiplicative seasonal factor Then This is often called seasonal index
18
Seasonal indices in multiplicative model Get the trend: Remove the effects of the seasonal and random variations by regression analysis = b 0 + b 1 t For each time period compute the ratio y t /y t which removes most of the trend variation > For each season calculate the average of y t /y t which provides the measure of seasonality. Adjust the average above so that the sum of averages of all seasons is equal to number of seasons (if necessary) >
19
Source for the following example http://www.economagic.com/em-cgi/data.exe/doeme/txrcbus http://www.economagic.com/em-cgi/data.exe/doeme/txrcbus 1 Btu ≈ 1 055 joules British thermal unit
20
Computing Seasonal Indexes Calculate the quarterly seasonal indexes for Residential Primary Energy Consumption (in Trillion Btu) in order to measure seasonal variation.
21
Plot the data!
22
Computing Seasonal Indexes Perform regression analysis for the model y = 0 + 1 t + where t represents the time, and y represents the occupancy rate. Time (t) Btu 1 3102 2 1221 3 821 4 1756 5 2803 6 1273 7 800 8 2078.. The regression line represents trend.
23
t y t Ratio 1310218783102/1878=1.65 2122118651221/1865=0.66 3…………………………………………………. No trend is observed, but seasonality and randomness still exist. =1890.219-12.583(1) The Ratios y t y t >
24
The Average Ratios by Seasons (1.65+ 1.53 + 1.81+ 1.78+ 1.78)/5 = 1.71Average ratio for quarter 1: To remove most of the random variation but leave the seasonal effects,average the terms for each season. Average ratio for quarter 2: (0.65+0.70+0.74+0.70+0.76)/5 = 0.71 Average ratio for quarter 3: (0.44+0.44+0.47+0.48+0.50)/5 = 0.47 Average ratio for quarter 4: (0.95+1.16+1.11+1.15+1.17)/ 5 = 1.11
25
In this example the sum of all the averaged ratios must be 4, such that the average ratio per season is equal to 1. If the sum of all the ratios is not 4, we need to adjust them proportionately. In our problem the sum of all the averaged ratios is equal to 4: 1.71+ 0.71 + 0.47 + 1.11 = 4.0. No normalization is needed. These ratios become the seasonal indexes. Suppose the sum of ratios is equal to 4.1. Then each ratio will be multiplied by 4/4.1. Adjusting the Average Ratios
26
The seasonal indexes tell us what is the ratio between the time series value at a certain season, and the overall seasonal average. In our problem: Q11.7171% above the annual average Q20.7129% below the annual average Q30.4753% above the annual average Q41.1111% above the annual average Interpreting the Seasonal Indexes
27
The trend component and the seasonality component are recomposed using the multiplicative model. This is used for forecasting. Quarter 1, 2001: Quarter 2, 2001: The Smoothed Time Series
28
Seasonal analysis The purpose is to Describe the seasonal component in order to make forecasts Deseasonalize the time series (makes it for example easier to compare timeseries over seasons)
29
Deseasonalized Time Series By removing the seasonality, we can identify changes in the other components of the time series, that might have occurred over time. Seasonally adjusted time series = Actual time series Seasonal index
30
Deseasonalized Time Series In period #1 ( quarter 1): In period #2 ( quarter 2): In period #5 ( quarter 1):
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.