Mba 532 2011_part_3_time_series_analysis


Published on

1 Like
    Agen Poker Online
    Are you sure you want to  Yes  No
    Your message goes here
    Agen Asiapoker77
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Mba 532 2011_part_3_time_series_analysis

  1. 1. MBA 532 Business Statistics by Rushan Abeygunawardana Department of Statistics, University of Colombo
  2. 2. Introduction <ul><li>A time series is a collection of observations made sequentially in time. </li></ul><ul><ul><li>In economics and business </li></ul></ul><ul><ul><ul><li>Share price on successive days </li></ul></ul></ul><ul><ul><ul><li>Export total in successive months, Yearly sales figures </li></ul></ul></ul><ul><ul><ul><li>Weekly bank interest rates </li></ul></ul></ul><ul><ul><li>In meteorology </li></ul></ul><ul><ul><ul><li>Daily rainfall, daily temperature </li></ul></ul></ul><ul><ul><ul><li>Hourly wind speed </li></ul></ul></ul><ul><ul><li>In demography </li></ul></ul><ul><ul><ul><li>Population of a country in successive years </li></ul></ul></ul><ul><ul><li>In marketing </li></ul></ul><ul><ul><ul><li>Sales in successive months </li></ul></ul></ul><ul><li>The purposes of time series analysis are; </li></ul><ul><ul><li>To understand or model the behavior of the observed series. </li></ul></ul><ul><ul><li>To predict or forecast future of a series based on the past values of the series. </li></ul></ul>
  3. 3. Continuous and Discrete Time Series <ul><li>A time series is said to be continuous when observations are made continuously in time. The term “continuous’ is used for series of this type even when the measured variable can only take a discrete set of values. </li></ul><ul><li>A time series is said to discrete when observations are taken only at specific times, usually equally spaced. The term “discrete” is used for series of this type even when the measured variable is a continuous variable. </li></ul>
  4. 4. Continuous and Discrete Time Series <ul><li>In the discrete time series the observations are usually taken at equally intervals. </li></ul><ul><li>Discrete time series can arise in several ways. </li></ul><ul><ul><li>Sampled: Read off (or digitize) a continuous time series model with the values at equal interval of time. </li></ul></ul><ul><ul><li>Aggregate (accumulate) : E.g.: monthly exports, weekly rainfall </li></ul></ul><ul><li>The special feature of time series analysis is the fact that successive observations are usually not independent and that the analysis must taken into account the time order of the observations. </li></ul><ul><li>When successive observations are dependent the future values may be forecast form the past data. </li></ul>
  5. 5. Deterministic Time Series and Stochastic Time Series <ul><li>Deterministic Time Series </li></ul><ul><ul><li>If a time series can be forecast exactly, it is said to be deterministic time series. </li></ul></ul><ul><li>Stochastic Time Series </li></ul><ul><ul><li>For stochastic time series the exact prediction is impossible and must be replaced by the idea that future values have a probability distribution which is conditioned by knowledge of the past values. </li></ul></ul>
  6. 6. Objectives of Time Series Analysis <ul><li>There are several possible objectives in time series analysis and these objectives may be classified as; </li></ul><ul><ul><li>Description </li></ul></ul><ul><ul><li>Explanation </li></ul></ul><ul><ul><li>Forecasting </li></ul></ul><ul><ul><li>Control </li></ul></ul>
  7. 7. Objectives of Time Series Analysis <ul><ul><li>Description </li></ul></ul><ul><li>In the time series analysis the first step is plot the data and obtained simple descriptive measures of the main properties of the series. (i.e. tread, seasonal variations, outliers, turning points etc.) </li></ul><ul><li>In the plot of the raw sales data; </li></ul><ul><ul><li>There are upward trends </li></ul></ul><ul><ul><li>There are downward trends </li></ul></ul><ul><ul><li>There are turning points </li></ul></ul><ul><li>For some series, the variation is dominated by such “obvious” features (trend and seasonal variation) and a fairly simple model may be perfectly adequate. </li></ul><ul><li>For some other series, more advance techniques will be required. And more complex models (such as various types of stochastic process) are required to describe the series. </li></ul>
  8. 8. Objectives of Time Series Analysis <ul><ul><li>Explanation </li></ul></ul><ul><li>When observations are taken on two or more variables, it may be possible to use the variation in one series to explain the variation in the other series. </li></ul><ul><ul><ul><li>To see how see level is affected by temperature and pressure </li></ul></ul></ul><ul><ul><ul><li>To see how sales are affected by price and economic conditions </li></ul></ul></ul><ul><ul><ul><li>To see how sales of soft drink varies with the daily temperature </li></ul></ul></ul><ul><li>A stochastic model is fitted and then forecast the future values and then input process is adjusted so as to keep the process on target. </li></ul>
  9. 9. Objectives of Time Series Analysis <ul><ul><li>Forecasting (Predicting) </li></ul></ul><ul><li>Given an observed time series, one may want to predict the future values of the series. </li></ul><ul><li>Forecasting is vary important task in the analysis of economic and industrial time series. </li></ul>
  10. 10. Objectives of Time Series Analysis <ul><ul><li>Control </li></ul></ul><ul><li>When a time series is generated, which measure the “quality” of a manufacturing process, the aim of analysis may be to control the process. Control processes are of several different kinds. </li></ul><ul><li>In quality control, observations are plotted on a control chart and controller takes actions using pattern of the graph. </li></ul>
  11. 11. Types of variations <ul><li>Traditional models of time series analysis are mainly concerned with decomposing the variation in a series into; </li></ul><ul><ul><li>Trend </li></ul></ul><ul><ul><li>Seasonal variation </li></ul></ul><ul><ul><li>Cyclic variation </li></ul></ul><ul><ul><li>Irregular variation </li></ul></ul><ul><li>Trend (T) </li></ul><ul><ul><li>This is defined as “long term change in mean”. Trend measured the average change in the variable per unit time. It shows the graduate and general pattern of development, which is often described by a straight line or some type of smooth curve. </li></ul></ul><ul><ul><li>When speaking of a trend, we must take into account the number of observations available and make subjective assessment of what is long term trend. </li></ul></ul>
  12. 12. Types of variations <ul><li>Seasonal variation (S) </li></ul><ul><li>Many time series exhibits variation which is annual in period . This variation arises due to the seasonal factors. This yearly variation is easy to understand and we shall see that is can be measured explicitly and /or removed from the data to give de-seasonalized data. </li></ul><ul><ul><li>Sales of school stationeries in December and January </li></ul></ul><ul><ul><li>Sales of charismas trees </li></ul></ul>
  13. 13. Types of variations <ul><li>Cyclic variation </li></ul><ul><li>Apart from the seasonal effects, sometimes series shows variation at a fixed period of time due to some another physical causes. </li></ul><ul><li>Daily variation in temperature </li></ul><ul><li>Cyclic variation is characterized by recurring up and down movements which are different form seasonal fluctuations in that they extend over longer / shorter period of time, usually two or more years or less than one year. </li></ul>
  14. 14. Types of variations <ul><li>Irregular variation </li></ul><ul><li>After trend and cyclic variation has been removed from a set of data, we are left with a series of residuals, which may or may not be “random”. Then we may see some anther type of variation which do not show a regular pattern and it is called the irregular variation. </li></ul><ul><li>We shall examine various techniques for analyzing series of this type to see if some of the appropriate irregular variation may be explained in terms of probability models such as Moving Average (MA) or Autoregressive (AR) models which will be discussed later. </li></ul>
  15. 15. Stationary Time Series <ul><li>This is a time series with; </li></ul><ul><ul><li>No systematic change in mean (No trend) </li></ul></ul><ul><ul><li>No systematic change in variation (No seasonal variation) </li></ul></ul><ul><ul><li>No strictly periodic variation (No cyclic variation). </li></ul></ul><ul><li>Most of the probability theory (stochastic process) of time series is concerned with stationary time series and for this reason time series analysis often requires one to turn a non-stationary into a stationary one so as to use these theories. </li></ul><ul><li>That is, it may be interested of remove the trend and seasonal variation from a set of data and then try to model the variation in residuals by means of stationary stochastic process. </li></ul>
  16. 16. Time Plot <ul><li>This is the first step in analyzing a time series data. That is plot the observations against time. The time plot shows whether and how the values in a dataset change over time. You can make a time plot of any numeric data. </li></ul><ul><li>Time Plot graphs are similar to X-Y graphs, and are used to display time-value data pairs. A Time Plot data item consists of two data values—the time and the value—which translate into the x and y coordinate, respectively. Each data item is displayed as a symbol, but you can add a line, bubbles, or fill areas to better delineate the data. Because of the nature of the coordinate system, Time Plot graphs do not have categories. </li></ul><ul><li>Time graphs are good for graphing the values at irregular intervals, such as sampling data at random times. </li></ul><ul><li>Plotting a time series is not a easy task. The choice of scales, the size of the intercept, and the way that the points are plotted (continuous lines or separate points) may substantially affected the way the plot “look” and so the analyst must examine very carefully and make the judgments. </li></ul>
  17. 17. Common Approaches to Forecasting <ul><li>Used when historical data are unavailable </li></ul><ul><li>Considered highly subjective and judgmental </li></ul>Common Approaches to Forecasting Causal Quantitative forecasting methods Qualitative forecasting methods Time Series <ul><li>Use past data to predict future values </li></ul>
  18. 18. Common Approaches to Forecasting… <ul><li>Quantitative forecasting methods can be used when: </li></ul><ul><ul><li>Past information about the variable being forecast is available, </li></ul></ul><ul><ul><li>The information can be quantified, and </li></ul></ul><ul><ul><li>It can be assumed that the pattern of the past will continue into the future </li></ul></ul><ul><li>In such cases, a forecast can be developed using a time series method or a causal method: </li></ul><ul><ul><li>Time series methods: The historical data are restricted to past values of the variable. The objective is to discover a pattern in the historical data and then extrapolate the pattern into the future. Ex.: trend analysis, classical decomposition, moving averages, exponential smoothing, ARIMA. </li></ul></ul><ul><ul><li>Causal forecasting methods: Based on the assumption that the variable we are forecasting has a cause-effect relationship with one or more other variables (e.g.: the sales volume can be influenced by advertising expenditures). Ex.: regression analysis. </li></ul></ul><ul><li>Qualitative methods generally involve the use of expert judgment to develop forecasts. </li></ul>
  19. 19. Traditional Models in Time Series Analysis <ul><li>A procedure for dealing with a time series is to fit a suitable model to the data. There are three commonly use time series. </li></ul><ul><ul><li>Additive models </li></ul></ul><ul><ul><li>Multiplicative models </li></ul></ul><ul><ul><li>A combination of 1 and 2 </li></ul></ul>
  20. 20. Smoothing the Time Series <ul><li>Calculate moving averages to get an overall impression of the pattern of movement over time </li></ul><ul><li>Moving Average: </li></ul><ul><ul><li>averages of consecutive time series values for a chosen period of length L </li></ul></ul><ul><ul><li>A series of arithmetic means over time </li></ul></ul><ul><ul><li>Result dependent upon choice of L (length of period for computing means) </li></ul></ul><ul><ul><li>Example : Five-year moving average </li></ul></ul><ul><ul><ul><li>First average: </li></ul></ul></ul><ul><ul><ul><li>Second average: </li></ul></ul></ul>
  21. 21. Example: Moving Average Method 23 40 25 27 32 48 33 37 37 50 40 1 2 3 4 5 6 7 8 9 10 11 Sales Year
  22. 22. Calculating Moving Averages <ul><li>Each moving average is for a consecutive block of 5 years </li></ul>40 50 37 37 33 48 32 27 25 40 23 Sales 11 10 9 8 7 6 5 4 3 2 1 Year 9 8 7 6 5 4 3 Average Year 5-Year Moving Average 39.4 41.0 37.4 35.4 33.0 34.4 29.4
  23. 23. Exponential Smoothing <ul><li>A weighted moving average </li></ul><ul><ul><li>Weights decline exponentially </li></ul></ul><ul><ul><li>Most recent observation weighted most </li></ul></ul><ul><li>Used for smoothing and short term forecasting (often one period into the future) </li></ul><ul><li>The weight (smoothing coefficient) is W </li></ul><ul><ul><li>Subjectively chosen </li></ul></ul><ul><ul><li>Range from 0 to 1 </li></ul></ul><ul><ul><li>Smaller W gives more smoothing, larger W gives less smoothing </li></ul></ul><ul><li>The weight is: </li></ul><ul><ul><li>Close to 0 for smoothing out unwanted cyclical and irregular components </li></ul></ul><ul><ul><li>Close to 1 for forecasting </li></ul></ul>
  24. 24. Exponential Smoothing Model <ul><li>Exponential smoothing model </li></ul>where: E i = exponentially smoothed value for period i E i-1 = exponentially smoothed value already computed for period i - 1 Y i = observed value in period i W = weight (smoothing coefficient), 0 < W < 1 For i = 2, 3, 4, …
  25. 25. Exponential Smoothing Example <ul><li>Suppose we use weight W = 0.2 </li></ul>E 1 = Y 1 since no prior information exists -- 23 26.4 26.12 26.296 27.437 31.549 31.840 32.872 33.697 etc. Forecast from prior period (E i-1 ) 23 40 25 27 32 48 33 37 37 50 etc. Sales (Y i ) 23 (.2)(40)+(.8)(23)=26.4 (.2)(25)+(.8)(26.4)=26.12 (.2)(27)+(.8)(26.12)=26.296 (.2)(32)+(.8)(26.296)=27.437 (.2)(48)+(.8)(27.437)=31.549 (.2)(48)+(.8)(31.549)=31.840 (.2)(33)+(.8)(31.840)=32.872 (.2)(37)+(.8)(32.872)=33.697 (.2)(50)+(.8)(33.697)=36.958 etc. Exponentially Smoothed Value for this period (E i ) 1 2 3 4 5 6 7 8 9 10 etc. Time Period (i)
  26. 26. Sales vs. Smoothed Sales <ul><li>Fluctuations have been smoothed </li></ul><ul><li>The smoothed value in this case is generally a little low, since the trend is upward sloping and the weighting factor is only .2 </li></ul>
  27. 27. Trend-Based Forecasting <ul><li>Forecast for time period 6: </li></ul>20 40 30 50 70 65 ?? 0 1 2 3 4 5 6 1999 2000 2001 2002 2003 2004 2005 Sales (y) Time Period (X) Year
  28. 28. Introduction to ARIMA models <ul><li>The Autoregressive Integrated Moving Average (ARIMA) models, or Box-Jenkins methodology, are a class of linear models that is capable of representing stationary as well as non-stationary time series. </li></ul><ul><li>ARIMA models rely heavily on autocorrelation patterns in data. </li></ul><ul><li>Both ACF and PACF are used to select an initial model. </li></ul><ul><li>The Box-Jenkins methodology uses an iterative approach: </li></ul><ul><ul><li>An initial model is selected, from a general class of ARIMA models, based on an examination of the TS and an examination of its autocorrelations for several time lags. </li></ul></ul><ul><ul><li>The chosen model is then checked against the historical data to see whether it accurately describes the series: the model fits well if the residuals are generally small, randomly distributed, and contain no useful information. </li></ul></ul><ul><ul><li>If the specified model is not satisfactory, the process is repeated using a new model designed to improve on the original one. </li></ul></ul><ul><ul><li>Once a satisfactory model is found, it can be used for forecasting. </li></ul></ul>
  29. 29. Autoregressive Models AR(p) <ul><li>An AR(p) model is a regression model with lagged values of the dependent variable in the independent variable positions, hence the name autoregressive model. </li></ul><ul><li>A p th-order autoregressive model, or AR(p), takes the form: </li></ul><ul><li>Autoregressive models are appropriate for stationary time series, and the coefficient Ф 0 is related to the constant level of the series. </li></ul>
  30. 30. AR(p) <ul><li>Theoretical behavior of the ACF and PACF for AR(1) and AR(2) models: </li></ul>ACF  0 PACF = 0 for lag > 2 AR(2) ACF  0 PACF = 0 for lag > 1 AR(1)
  31. 31. Moving Average Models MA(q) <ul><li>MA(q) model is a regression model with the dependent variable, Yt, depending on previous values of the errors rather than on the variable itself. </li></ul><ul><li>A q th-order moving average model, or MA(q), takes the form: </li></ul><ul><li>MA models are appropriate for stationary time series. The weights ω i do not necessarily sum to 1 and may be positive or negative. </li></ul>
  32. 32. MA(q) <ul><li>Theoretical behavior of the ACF and PACF for MA(1) and MA(2) models: </li></ul>MA(2) ACF = 0 for lag > 2; PACF  0 MA(1) ACF = 0 for lag > 1; PACF  0
  33. 33. ARMA(p,q) Models <ul><li>A model with autoregressive terms can be combined with a model having moving average terms to get an ARMA(p,q) model: </li></ul><ul><li>ARMA(p,q) models can describe a wide variety of behaviors for stationary time series. </li></ul><ul><li>Theoretical behavior of the ACF and PACF for autoregressive-moving average processes: </li></ul><ul><li>Note that: </li></ul><ul><li>ARMA(p,0) = AR(p) </li></ul><ul><li>ARMA(0,q) = MA(q) </li></ul>In practice, the values of p and q each rarely exceed 2 . <ul><li>In this context… </li></ul><ul><li>“ Die out” means “tend to zero gradually” </li></ul><ul><li>“ Cut off” means “disappear” or “is zero” </li></ul>ACF PACF AR(p) Die out Cut off after the order p of the process MA(q) Cut off after the order q of the process Die out ARMA(p,q) Die out Die out
  34. 34. Example: Fitting an ARIMA Model The series show an upward trend . The first several autocorrelations are persistently large and trailed off to zero rather slowly  a trend exists and this time series is nonstationary (it does not vary about a fixed level) Idea: to difference the data to see if we could eliminate the trend and create a stationary series.
  35. 35. Example: Fitting an ARIMA Model… A plot of the differenced data appears to vary about a fixed level. Comparing the autocorrelations with their error limits, the only significant autocorrelation is at lag 1. Similarly, only the lag 1 partial autocorrelation is significant. The PACF appears to cut off after lag 1, indicating AR(1) behavior. The ACF appears to cut off after lag 1, indicating MA(1) behavior  we will try: ARIMA(1,1,0) and ARIMA(0,1,1) A constant term in each model will be included to allow for the fact that the series of differences appears to vary about a level greater than zero.
  36. 36. Example: Fitting an ARIMA Model… The LBQ statistics are not significant as indicated by the large p-values for either model. ARIMA(1,1,0) ARIMA(0,1,1)
  37. 37. Example: Fitting an ARIMA Model… Finally, there is no significant residual autocorrelation for the ARIMA(1,1,0) model. The results for the ARIMA(0,1,1) are similar. Therefore, either model is adequate and provide nearly the same one-step-ahead forecasts.
  38. 38. The first sample ACF coefficient is significantly different form zero. The autocorrelation at lag 2 is close to significant and opposite in sign from the lag 1 autocorrelation. The remaining autocorrelations are small. This suggests either an AR(1) model or an MA(2) model. The first PACF coefficient is significantly different from zero, but none of the other partial autocorrelations approaches significance, This suggests an AR(1) or ARIMA(1,0,0) ARIMA The time series of readings appears to vary about a fixed level of around 80, and the autocorrelations die out rapidly toward zero  the time series seems to be stationary .
  39. 39. Both models appear to fit the data well. The estimated coefficients are significantly different from zero and the mean square ( MS ) errors are similar. ARIMA AR(1) = ARIMA(1,0,0) MA(2) = ARIMA(0,0,2) A constant term is included in both models to allow for the fact that the readings vary about a level other than zero. Let’s take a look at the residuals ACF …
  40. 40. ARIMA Finally, there is no significant residual autocorrelation for the ARIMA(1,0,0) model. The results for the ARIMA(0,0,2) are similar. Therefore, either model is adequate and provide nearly the same three-step-ahead forecasts. Since the AR(1) model has two parameters (including the constant term) and the MA(2) model has three parameters, applying the principle of parsimony we would use the simpler AR(1) model to forecast future readings.
  41. 41. Building an ARIMA model <ul><li>The first step in model identification is to determine whether the series is stationary. It is useful to look at a plot of the series along with the sample ACF. </li></ul><ul><li>If the series is not stationary, it can often be converted to a stationary series by differencing: the original series is replaced by a series of differences and an ARMA model is then specified for the differenced series (in effect, the analyst is modeling changes rather than levels) </li></ul><ul><li>Models for nonstationary series are called Autoregressive Integrated Moving Average models, or ARIMA(p,d,q), where d indicates the amount of differencing. </li></ul><ul><li>Once a stationary series has been obtained, the analyst must identify the form of the model to be used by comparing the sample ACF and PACF to the theoretical ACF and PACF for the various ARIMA models. </li></ul><ul><li>Principle of parsimony: “all things being equal, simple models are preferred to complex models” </li></ul><ul><li>Once a tentative model has been selected, the parameters for that model are estimated using least squares estimates. </li></ul>
  42. 42. Building an ARIMA model … <ul><li>Before using the model for forecasting, it must be checked for adequacy. Basically, a model is adequate if the residuals cannot be used to improve the forecasts, i.e., </li></ul><ul><ul><li>The residuals should be random and normally distributed </li></ul></ul><ul><ul><li>The individual residual autocorrelations should be small. Significant residual autocorrelations at low lags or seasonal lags suggest the model is inadequate </li></ul></ul><ul><li>After an adequate model has been found, forecasts can be made. Prediction intervals based on the forecasts can also be constructed. </li></ul><ul><li>As more data become available, it is a good idea to monitor the forecast errors, since the model must need to be reevaluated if: </li></ul><ul><ul><li>The magnitudes of the most recent errors tend to be consistently larger than previous errors, or </li></ul></ul><ul><ul><li>The recent forecast errors tend to be consistently positive or negative </li></ul></ul><ul><li>Seasonal ARIMA (SARIMA) models contain: </li></ul><ul><ul><li>Regular AR and MA terms that account for the correlation at low lags </li></ul></ul><ul><ul><li>Seasonal AR and MA terms that account for the correlation at the seasonal lags </li></ul></ul>
  43. 43. Introduction to ARIMA models
  44. 44. <ul><li>The End </li></ul>Rushan A B Abeygunawardana Thursday, December 1, 2011