1、Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,11/16/2017,#,TIME-SERIES ANALYSIS,2,2,TIME SERIES,A time,-,series is a collection of data observed in time t=1,2,T.,We can think of time,-,series as a particular realization of,a,stoch
2、astic process(population).,Stochastic process is a set of time indexed random variables,:,We will consider only discrete time,-,series with observations made at equidistant time intervals,or time points,3,3,Objectives of time,-,series analysis:,understanding the behavior,of underlying stochastic pro
3、cess,explaining the variations of a time,-,series in the past,forecasting of future values from the current and past values,Properties of time,-,series data:,Property#1:,Time,-,series data have,autoregressive(AR)dynamics,i.e.,current value depends on,past values,.,This often results in a violation,o
4、f,no autocorrelation,in the residuals of a standard OLS model,(error terms should be,independently,distributed,),.,OLS approach can produce,a,spurious results,when we do,n,t account for AR dynamics,!,4,4,Properties of time,-,series data:,Property#2:,Time,-,series data often have,time-dependent momen
5、ts,(e.g.mean,and/or,variance,of a time-series are increasing over time,),This is a property of time series data called,nonstationarity,However,i,f two independent,nonstationary series are regressed on each other,the chance for finding a spurious relationship is very high.,Property#,3,:,Events in a t
6、ime series can cause,structural breaks,in the data.,We can estimate these changes with,regime switching models,etc.,5,5,Properties of,time,-,series,data,:,Property#,4,:,Many time series are in an equilibrium relationship over time,what we call,cointegration,(variables are related in a short-term and
7、 in a long-term),.,We can model this relationship with error correction model,(ECM).,Property#6:,Many time series data are,endogenously related,which we can model with system of equations,such as vector autoregression(VAR).,Many economic time-series usually exhibit trends and/or seasonal variations.
8、Economic time-series can be decomposed as,T,t,-trend component,(,long-term trending behavior,:upward or downward deterministic trend,),.,S,t,-seasonal component,(,short-term fluctuations repeated over a one-year period,-monthly or quarterly observations,are required),C,t,-cyclical,component,(,long-
9、term fluctuations repeated over a few-years period,-,yearly,data of sufficiently long period are required,),u,t,-random or irregular component(,refers to deviations from the trend,seasonal and cyclical component,),Example by STATA,Import the file,economic ndicators.dta,to STATA,This workfile contain
10、s,time series,data from period 2000Q1 to 2014Q3(,59 quarters,)with respect to,some,economic indicators of,China,Range,of,observations is extended,for the out of sample observations(,observations in the sample+observations out of,sample;59+,9,=68,).,Declare your data to be a time-series data,tsset da
11、te,Plot a time-series of gdp,t,sline gdp,Create variable time and time,2,using commands:,gen,time=_n,gen,time2=time*time,Create seasonal dummy variables,for each quarter:,gen,q=quarter(dofq(date),gen q1,=(,q,=,1,),gen q2,=(,q,=,2,),gen q3,=(,q,=,3,),gen,q4,=(,q,=,4,),Example by STATA,Estimate regres
12、sion with quadratic trend and seasonal dummy variables for GDP time series by omitting a dummy for first quarter:,r,egress gdp time time2 q2 q3 q4,Estimate regression with quadratic trend and seasonal dummy variables for GDP time series by omitting a dummy for first,quarter:,regress,gdp time time2,q
13、1 q2 q3,Compute forecast values(predicted or fitted values)according to the estimated model:,p,redict forecast,xb,Compare actual values with forecast values on the same graph:,t,sline gdp forecast,Compute residuals and test if residuals are white noise(including,1 and,2 lags):,predict res,residuals,
14、wntestq res,lags(1),wntestq,res,lags(2),STATIONARY TIME-SERIE,S,A time-series is stationary if following moments,are constant,(independent of time):,1.mean(expected value),2.variance,3.,(,auto,),covariance,9,Covariance between two shifted values of a time-series is called,autocovariance,Autocovarian
15、ce depends only on the time difference,k,(time lag),but it is time invariant,Also,the,autocorrelation,between and is a function of,k,but it does not depend on t,ime,t,10,When process is a white noise,then:,For a white noise process the autocorrelation function(ACF)is equal to zero.,11,Autocorrelatio
16、n function is a sequence of autocorrelation coefficients up to,k,time lags:,Autocorrelation function has the following properties:,Based on observed time-series these coefficients can be estimated from the sample:,For stationary time series the ACF decreases quickly if this happens at the first time
17、 lags(decreases exponentially or,by,alternating pattern),12,NONSTATIONARITY,Values of sample ACF coefficients are significant and decrease slowly,Causes of nonstationarity:presense of sesonality,heteroskedasticity,structural breaks,deterministic trend or stochastic trend.,Stochastic trend can be des
18、cribed as a random,walk,Random walk model without constant term:,Random walk model with constant term:,13,NONSTATIONARITY,Random walk is a special case of the first order autoregression,or AR(1)model:,Random walk without constant:,Random walk with constant:,When,the slope of AR(1)is 1,then a model c
19、ontains a,unit root,-it,is,nonstationary,because,the variance,of a random walk,increases over time and sample ACF decreases very slowly(values of the sample ACF are very close to 1),14,The test of nonstationarity is called a,unit root test,:,Unit root test is based on the t-,statistics within,Dickey
20、Fuller distribution,Dickey-Fuller test,(DF).,If the null hypothesis,is not,rejected then we said that time-series is nonstationary and the first differences should be taken,.If the,series of the,first differences,is,stationary then such time-series is called,difference-stationary.,If the series of
21、the first differences is stationary then,it is,integrated of order one.,15,Example by STATA,Plot,a time-series growth and,ACF function,up to 10 lags,:,t,sline growth,corrgram growth,lags(10,),Generate variable growth with 1 time lag and present current valuse of growth against growth from previous p
22、eriod using scatterplot,gen growth_1=L.growth,scatter growth growth_1,Perform Dickey-Fuller test in the levels for growth,(show test equation),dfuller growth,regress,regress d.growth,L.growth,Plot a time-series of,production and,perform,Dickey-Fuller test in the,levels,tsline production,dfuller prod
23、uction,regress,Perform Dickey-Fuller test in,first differences for growth and production(without,test equation),dfuller d.growth,dfuller d.production,DYNAMIC MODELS,General linear dynamic model in econometrics is a linear autoregressive distributed lag model(ADL)which combines two dynamic models:,(1
24、)autoregressive model and,(2)distributed lag model.,Autoregressive part of the model includes a lagged dependent variables as an independent ones()while a distributed lag model includes a lagged independent variables().,Due to simplicity,ADL(1,1),model will be considered to explain several special t
25、ypes of dynamic models commonly used in econometrics.,17,Impulse response function for ADL(1,1)model:,18,In the long run we expected that variables are in a equilibrium state.,The equation of the long-run equilibrium from ADL(1,1)model is:,Parameter determines the speed of adjustment to the equilibr
26、ium state.,In the long run,the expected effect of variable X on variable Y is given by:,19,Dynamic models are of special interest to economists because they provide information about the short and the long term effect between the observed variables,Equilibrium(steady,state,),exists between two varia
27、bles if they are related in the long,-term,(cointegrated variables),If two variables are related in the long,-term,then they are also related in the short,-term,Deviations from the equilibrium may exist in the short,-term,(short term disequilibrium),The short-term and long-term dynamics between econ
28、omic variables are usually analyzed using so called error correction model(ECM).,I,t can be shown that the ECM is equivalent to the ADL(1,1)model,20,ERROR CORRECTION MODEL,Equivalence of the ECM and ADL(1,1)model:,Parameter gives the rate(speed)at which the model returns to its equilibrium level.For
29、mally,tells us the proportion of the disequilibrium which is corrected with each period.This coefficient should be negative and less than 1 in absolute value.,The term“error correction”applies to any model that directly estimates the rate at which changes in return to equilibrium after a change in .
30、21,ERROR CORRECTION MODEL,The basic structure of an ECM:,EC is the error correction component of the model and measures the speed at which prior deviations from equilibrium are corrected.,If there is no long-run relationship then .,ECMs are useful models when dealing with integrated data,but can al
31、so be used with stationary data.,According to Granger,cointegration check is necessary to avoid spurious regressions.,When two random walk(nonstationary)variables(integrated of order 1)are cointegrated,then an error correction model can be formulated to study their short run dynamics.,22,ERROR CORRE
32、CTION MODEL,When dealing with cointegrated variables an ECM can be estimated using two step approach proposed by Engle and Granger.,1.Step-regress Y on X and obtain residuals from a static regression,2.Step-regress,Y on,X and lagged residuals from the first step regression,If variables are cointegra
33、ted then a static regression from the first step is called cointegration equation,while the second regression is an ECM.,If variables are nonstationary but not cointegrated then a static regression from the first step is“spurious”(high R-square,small standard errors and inflated t-ratios)-solution t
34、hat solves“spurious”regression problem is to analyze the data in the first differences.,A model that includes only differenced variables give us information about the shot run effect of X on Y.,When dealing with stationary time series variables an ECM can be estimated using single equation.,23,ECM a
35、nd COINTEGRATION,Cointegrated data are never expected to drift too far away from each other,maintaining an equilibrium relationship.,If two time series are integrated of the same order AND some linear combination of them is stationary,then the two series are cointegrated.,24,ECM and COINTEGRATION,Co
36、integrated series share a long-term equilibrium relationship.,Deviations from this equilibrium in the short-term are corrected over time.,Integrated time series:,(a)follow,s,a random walk process,(b)the variance,is not constant,(c)the effect of any shock is permanently incorporated into the series,(
37、d)it is not mean-revertin,g,25,ECM and COINTEGRATION,If the variables X and Y are nonstationary AND their linear combination is also nonstationary then the observed variables are not cointegrated.,Formal definition of cointegration:,if the two variable are of the same order of integration,d,and if,t
38、here,exist parameter such that error terms are integrated of,a lower,order,(,less then,d,),for example(,d-b,)for,b,0,then,both,variables are,said to be,cointegrated of the order,.,26,ECM and COINTEGRATION,The Engle and Granger 2-step approach is really a 3-step method:,1)Determine that all time,-,se
39、ries are integrated of the same order(perform a unit root test for each variable-Dickey-Fuller),2)Demonstrate that the time,-,series X and Y are cointegrated(perform a unit root test of residuals obtained from a static regression model).,3)Enter the lagged residuals from the previous period into a r
40、egression of Yt on Xt.,27,Example by STATA,Estimate a static model between growth and production and save residuals as resid:,r,egress growth production,p,redict residuals,resid,Perform Dickey-Fuller test in the levels for,residuals(resid):,d,fuller resid,Estimate an Error Correction Model proposed
41、by Engle and Granger:,regress d.growth d.production L.resid,Estimate ADL(1,1)and EC representation of ADL(1,1):,r,egress growth production L.production L.growth,regress d.growth d.production,L.production,L.growth,ECM and COINTEGRATION,Estimation of an ECM using LS method based on a single equation a
42、pproach enables the analysis of the variables that are not cointegrated but stationary,if and only if it is satisfied the assumption of exogeneity.,This is the main advantage of this approach compared to Engle-Granger,two step approach,Exogeneity condition is met if the regressor(variable X)and the
43、error terms(u)are independent,If,this,condition is not met,i.e.the assumption of exogeneity is violated,there is a problem of ENDOGENEITY.,The problem of endogeneity means that the variable X is not strictly exogenous variable,.,In the empirical analyzes examining the problem of endogeneity is reduc
44、ed to the application of the Granger causality test.,29,GRANGER CAUSALITY,Th,e variable X,causes,varaible Y,if,and only if,the,past,values,of,X,provide additional,information,for the forecast,of,Y,.,The simplest form of Granger causality test can be performed using following regression,:,Variable,X,
45、does not cause varaible,Y,if all parameters are equal to zero(partial F-test-Wald test with linear restrictions),If X does not cause Y then the null-hypothesis will not be rejected.,If X causes Y then the null-hypothesis will,be rejected.,30,GRANGER CAUSALITY,If the variable X does not cause variabl
46、e,Y,it,does not mean that Y,cause,s,X.,I,f the,causality is present,in direction,Y X,then following regression should be estimated,If Y does not cause X then the null-hypothesis will not be rejected.,If Y causes X then the null-hypothesis will be rejected.,Granger causality test in this form can be
47、obtained only for stationary time series.,If the variables are,no,n,stationary,Granger causality test can be,obtained,using differenced data.,In the most,empirical,analysis,a,causality,test is usually,performed,in,both directions using a system of equations.The system of equations in which all varia
48、bles are endogenous,is called,vector,autoregression model(VAR,).,31,32,VECTOR AUTOREGRESSION MODEL,For simplicity a,bivariate,vector autoregression model with,1 time lag,is considered.,VAR(1)is a system of equations,model with,two endogenous variables,in reduced form,(each variable on the right is w
49、ith 1 time lag),If we denote vector then the,model in matrix form,becomes,33,VAR(1)MODEL,Reduced or a standard VAR(1)model is commonly used in,the literature,because parameters can be estimated by LS method equation by equation.,It is assumed that both error terms(from first and second equation)are
50、white noise with zero mean,constant variance and covariance equal to zero(off-diagonal elements of covariance matrix,should be zero).,Nine parameters should be estimated in total,(6 coefficients+3 elements of covariance matrix).,34,A,standard VAR(1)model is commonly used in practice and it requires
©2010-2025 宁波自信网络信息技术有限公司 版权所有
客服电话:4009-655-100 投诉/维权电话:18658249818