Time series modelling and statistical trends

Slides:



Advertisements
Similar presentations
Environmental change and statistical trends – some examples Marian Scott Dept of Statistics, University of Glasgow NERC August 2012.
Advertisements

Environmental change and statistical trends – some examples
Environmental change and statistical trends – some examples Marian Scott Dept of Statistics, University of Glasgow NERC September 2011.
Marian Scott SAGES, March 2009
A.S. 3.8 INTERNAL 4 CREDITS Time Series. Time Series Overview Investigate Time Series Data A.S. 3.8 AS91580 Achieve Students need to tell the story of.
DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos Exam 1 review: Quizzes 1-6.
Decomposition Method.
©The McGraw-Hill Companies, Inc. 2008McGraw-Hill/Irwin Lesson 12.
Time Series and Forecasting
Part II – TIME SERIES ANALYSIS C5 ARIMA (Box-Jenkins) Models
Time Series Building 1. Model Identification
Probabilistic & Statistical Techniques Eng. Tamer Eshtawi First Semester Eng. Tamer Eshtawi First Semester
1 BIS APPLICATION MANAGEMENT INFORMATION SYSTEM Advance forecasting Forecasting by identifying patterns in the past data Chapter outline: 1.Extrapolation.
Moving Averages Ft(1) is average of last m observations
Chapter 5 Time Series Analysis
Data Sources The most sophisticated forecasting model will fail if it is applied to unreliable data Data should be reliable and accurate Data should be.
Chapter 11 Multiple Regression.
Macroeconomic Facts Chapter 3. 2 Introduction Two kinds of regularities in economic data: -Relationships between the growth components in different variables.
Part II – TIME SERIES ANALYSIS C2 Simple Time Series Methods & Moving Averages © Angel A. Juan & Carles Serrat - UPC 2007/2008.
Business Statistics - QBM117 Statistical inference for regression.
McGraw-Hill/Irwin Copyright © 2010 by The McGraw-Hill Companies, Inc. All rights reserved. Time Series and Forecasting Chapter 16.
Time Series and Forecasting
Applied Business Forecasting and Planning
Inference for regression - Simple linear regression
Time Series “The Art of Forecasting”. What Is Forecasting? Process of predicting a future event Underlying basis of all business decisions –Production.
The Forecast Process Dr. Mohammed Alahmed
Datta Meghe Institute of Management Studies Quantitative Techniques Unit No.:04 Unit Name: Time Series Analysis and Forecasting 1.
CLASS B.Sc.III PAPER APPLIED STATISTICS. Time Series “The Art of Forecasting”
Non-continuous Relationships If the relationship between the dependent variable and an independent variable is non-continuous a slope dummy variable can.
Temperature correction of energy consumption time series Sumit Rahman, Methodology Advisory Service, Office for National Statistics.
TIME SERIES by H.V.S. DE SILVA DEPARTMENT OF MATHEMATICS
Chapter 14 – Correlation and Simple Regression Math 22 Introductory Statistics.
1 FORECASTING Regression Analysis Aslı Sencer Graduate Program in Business Information Systems.
Business Forecasting Used to try to predict the future Uses two main methods: Qualitative – seeking opinions on which to base decision making – Consumer.
Forecasting Revenue: An Example of Regression Model Building Setting: Possibly a large set of predictor variables used to predict future quarterly revenues.
Chapter 16: Time-Series Analysis
Copyright © 2015 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Intervention models Something’s happened around t = 200.
DSc 3120 Generalized Modeling Techniques with Applications Part II. Forecasting.
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Time Series Forecasting Chapter 16.
Copyright © 2014, 2011 Pearson Education, Inc. 1 Chapter 27 Time Series.
Introductory Statistics Week 4 Lecture slides Exploring Time Series –CAST chapter 4 Relationships between Categorical Variables –Text sections.
MBA.782.ForecastingCAJ Demand Management Qualitative Methods of Forecasting Quantitative Methods of Forecasting Causal Relationship Forecasting Focus.
Chapter 6 Business and Economic Forecasting Root-mean-squared Forecast Error zUsed to determine how reliable a forecasting technique is. zE = (Y i -
Time series Decomposition Farideh Dehkordi-Vakil.
Week 11 Introduction A time series is an ordered sequence of observations. The ordering of the observations is usually through time, but may also be taken.
© Copyright McGraw-Hill Correlation and Regression CHAPTER 10.
© 1999 Prentice-Hall, Inc. Chap Chapter Topics Component Factors of the Time-Series Model Smoothing of Data Series  Moving Averages  Exponential.
Copyright © 2011 Pearson Education, Inc. Time Series Chapter 27.
Forecasting (prediction) limits Example Linear deterministic trend estimated by least-squares Note! The average of the numbers 1, 2, …, t is.
1 BABS 502 Moving Averages, Decomposition and Exponential Smoothing Revised March 14, 2010.
Irwin/McGraw-Hill © Andrew F. Siegel, 1997 and l Chapter 14 l Time Series: Understanding Changes over Time.
Time-Series Forecast Models  A time series is a sequence of evenly time-spaced data points, such as daily shipments, weekly sales, or quarterly earnings.
Time Series and Forecasting Chapter 16 McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Ch16: Time Series 24 Nov 2011 BUSI275 Dr. Sean Ho HW8 due tonight Please download: 22-TheFed.xls 22-TheFed.xls.
©The McGraw-Hill Companies, Inc. 2008McGraw-Hill/Irwin Time Series and Forecasting Chapter 16.
Statistics for Business and Economics Module 2: Regression and time series analysis Spring 2010 Lecture 7: Time Series Analysis and Forecasting 1 Priyantha.
Forecasting. Model with indicator variables The choice of a forecasting technique depends on the components identified in the time series. The techniques.
Time Series Forecasting Trends and Seasons and Time Series Models PBS Chapters 13.1 and 13.2 © 2009 W.H. Freeman and Company.
Yandell – Econ 216 Chap 16-1 Chapter 16 Time-Series Forecasting.
Stats Methods at IC Lecture 3: Regression.
Regression Analysis AGEC 784.
What is Correlation Analysis?
Chapter 6: Autoregressive Integrated Moving Average (ARIMA) Models
“The Art of Forecasting”
Chapter 4: Seasonal Series: Forecasting and Decomposition
Correlation and Regression
CHAPTER 29: Multiple Regression*
Honors Statistics Review Chapters 7 & 8
CORRELATION & REGRESSION compiled by Dr Kunal Pathak
Presentation transcript:

Time series modelling and statistical trends Marian Scott and Adrian Bowman SEPA, July 2012

smoothing a time series In many time series, the seasonal variation can be so strong that it obscures any trend or cyclical component. for understanding the process being observed (and forecasting future values of the series), trends and cycles are of prime importance. Smoothing is a process designed to remove seasonality so that the long-term movements in a time series can be seen more clearly

smoothing a time series one of the most commonly used smoothing techniques is moving average. difficult choice: the window over which to smooth smooth series: Yi = wkYi+k other smoothing methods (more modern) commonly used include Lowess

smoothing a time series We have data , where Xt = number of bus passengers on the t'th day. Since the periodic variation is repeated every 7 days, a 7-period moving-average (Mt) is used to smooth the series, where: Mt = 1/7{Xt-3+Xt-2+…..+Xt+3} This averages out the seasonality, since each Mt is an average over 7 different 'seasons' (days of the week). Note, though, that Mt is only defined for t = 4, 5, ..., N-7. other smoothing methods (more modern) commonly used include Lowess

smoothing a time series one of the most commonly used smoothing techniques is moving average. smooth series: Yi = wkYi+k 3-point, 5-point, 7-point moving average example window may be chosen to reflect the periodicity of the data series other smoothing methods (more modern) commonly used include Lowess

smoothing a time series LO(W)ESS, is a method that is known as locally weighted polynomial regression. At each point in the data set a low-degree polynomial is fit to a subset of the data, with explanatory variable values near the point whose response is being estimated. The polynomial is fit using weighted least squares, giving more weight to points near the point whose response is being estimated and less weight to points further away. Many of the details of this method, such as the degree of the polynomial model and the weights, are flexible.

water surface temperature from Jan 1981- Feb 1992 (Piegorsch)- with lowess curve

Example : different smoothing technique applied to air quality data (that have been logged)

harmonic regression another way of a) describing and b) hence being able to remove the periodic component is to use what is called harmonic regression remember sin and cos from school? This allows us to capture the regular repeat pattern in each year – the seasonal effect

Yi = 0 +  cos (2[ti - ]/p) + i harmonic regression build a regression model using the sine function. sin () lies between -1 and +1, where  measured in radians. for a periodic time series Yi we can build a regression model Yi = 0 +  cos (2[ti - ]/p) + i to make this simpler, if we assume that p is known, this can be written as a simple multiple linear regression model

Yi = 0 +  sin (2[ti - ]/p) + i harmonic regression for a periodic time series Yi we can build a regression model Yi = 0 +  sin (2[ti - ]/p) + i to make this simpler, Yi = 0 + 1ci + 2si + i where ci = cos(2ti/p) and si = sin(2ti/p) So a regression model

Example: red curve shows the harmonic pattern (superimposed on a declining trend).

Example to try Qn 4 in practical3final.txt The script shows how we can create the new explanatory variables, doy is a new variable that records where in the year (which day from 366) the sample was taken.

seasonal indices and de-seasonalisation The reason for giving the seasonally-adjusted data is to make trends and cycles more apparent. seasonal adjustments best explained as step 1: define the Yt =Xt –Mt (actual-smoothed) step 2: average all the Yt values for each ‘season’ to give the same seasonal index (e.g. for quarterly data there would be 4 values), S step 3: the seasonally adjusted data Xt- S

correlation through time in many situations, we expect successive observations to show correlation at adjacent time points (most likely stronger the closer the time points are), strength of dependence usually depends on time separation or lag for regularly spaced data, we typically make use of the autocorrelation function (ACF) Data are NOT independent

correlation through time for regularly spaced time series, with no missing data, we define the sample mean in the usual way then the sample autocorrelation coefficient at lag k ( 0), r(k)- as the correlation between original series and a version shifted back k time units horizontal lines show approximate 95% confidence intervals for individual coefficients.

Example: ACF of raw water temperature data

correlation through time ACF shows a very marked cyclical pattern interpretation of the ACF we need to have removed both trend and seasonality we hope that (for simplicity in subsequent modelling) that only a few correlation coefficients (at small lags) will be significant. ACF an important diagnostic tool for time series modelling (formal models called ARIMA). how should we remove the seasonal pattern or the trend?

differencing a common way of removing a simple trend (eg linear) is by differencing define a new series Zt = Yt – Yt-1 a common way of removing seasonality (if we know the period to be p), is to take pth differences Zt = Yt – Yt-p

Example: ACF of water temperature data

Example 1: ACF of water temperature data- difference order 12

Examples to try In practical4.txt Exercises 1 and 2 Why is correlation important How good is the ACF as a diagnostic Exercise 2 shows the output from a single command stl (which is a decomposition of the data series into trend, seasonal component and residual)

simple algorithm obtain rough estimate of trend (smoothing but one not affected by seasonality): subtract estimated trend estimate seasonal cycle from detrended series what is left is the irregular component, good alternative- STL (seasonal trend lowess) decomposition

An example for you to try Exercise 3, Central England temperature obtain the acf use the stl() command Look at monthly data

A different type of change Change can be Abrupt As a result of an intervention So we might like to consider a slightly different form of model

Nile flow relatively poor fit of straight line model, lots of variation. some pattern in the residuals

A straight line model for the Nile relatively poor fit, lot of variation. any pattern in the residuals? this residual plot is against order of the observations

a non-parametric model for the Nile a smooth function (LOESS) or non-parametric regression model Seem OK? any suggestion that there may be a change-point?

A different type of change So we might like to consider a slightly different form of model- the river Nile was dammed in the late 1800s So there may be a changepoint- a shift in the mean flow level, and if so can we see it.

the smooths Two smooth curves are fit and we identify the biggest discrepancy between then with confidence bands added, helps identify the change location Where is the biggest discrepancy?

An alternative model for the Nile two smooth sections, broken at roughly 1900. different mean levels in the two periods so modelling the two periods separately

The moral of this example Trends can be challenging to identify Modelling needs to be flexible We need to be mindful of the assumptions

An example Haddocks- this is an example about fish stocks, we can try fitting some very simple time series regression models. We might want to predict what fish stocks might be several years in the future