时间序列分析及VAR模型
VAR模型的原理及应用

VAR模型的原理及应用1. 引言VAR(Vector Autoregression)模型是一种常用的计量经济学模型,用于分析多个相关时间序列变量之间的动态关系。
VAR模型在宏观经济学、金融学、营销研究等领域具有广泛的应用。
本文将介绍VAR模型的原理以及其在实际应用中的一些特点和注意事项。
2. VAR模型的原理VAR模型是基于时间序列数据的统计模型,它假设各个时间序列变量之间存在互相影响的关系。
VAR模型的核心思想是用当前变量的过去值和其他相关变量的过去值来预测当前变量的值。
具体来说,VAR模型可以表示为如下形式:$$ X_t = \\alpha_1X_{t-1} + \\alpha_2X_{t-2} + \\cdots + \\alpha_pX_{t-p} +\\epsilon_t $$其中,X t表示当前时间点的变量向量,$\\alpha_1, \\alpha_2, \\cdots,\\alpha_p$是模型的参数,$X_{t-1}, X_{t-2}, \\cdots, X_{t-p}$表示过去几个时间点的变量向量,$\\epsilon_t$表示误差项。
VAR模型的核心在于确定模型的参数和滞后阶数p。
参数的估计可以使用最小二乘法、极大似然法等方法。
滞后阶数的选择可以通过信息准则(如赤池信息准则、贝叶斯信息准则)来确定,一般通过对比不同滞后阶数下模型的拟合优度。
3. VAR模型的应用VAR模型具有广泛的应用场景,以下是一些常见的应用情况:3.1 宏观经济学中的应用对于宏观经济学研究来说,VAR模型可以用于分析不同经济指标之间的关系,例如国内生产总值(GDP)、消费者物价指数(CPI)、货币供应量等。
通过建立VAR模型,可以研究这些宏观经济指标之间的因果关系、冲击传递效应等。
3.2 金融领域中的应用VAR模型在金融领域中的应用广泛,可以用于分析股市、汇率、利率等金融变量之间的关系。
通过构建VAR模型,可以研究金融变量之间的动态相关性、风险传染效应等。
var模型原理与步骤

VAR模型(向量自回归模型)是一种用于预测和分析多个相关时间序列数据的统计模型。
它通过将系统中每一个内生变量作为系统中所有内生变量的滞后值的函数来构造模型,从而将单变量自回归模型推广到由多元时间序列变量组成的“向量”自回归模型。
VAR模型的原理基于以下假设:
1. 所有时间序列都是平稳的,即具有稳定的均值和方差。
2. 各个时间序列之间存在长期均衡关系,可以通过模型进行捕捉和量化。
3. 这些时间序列之间存在一定的滞后相关性,即一个变量的过去值可以影响其自身的未来值,也可以影响其他变量的未来值。
VAR模型的建立步骤如下:
1. 确定要纳入模型的时间序列,并检验这些时间序列是否具有平稳性。
如果时间序列不平稳,需要进行差分或取对数等转换使其平稳。
2. 根据AIC、SC、HQ等准则选择合适的滞后阶数。
3. 通过估计模型的参数来拟合模型,可以使用OLS、GLS、GMM 等估计方法。
4. 对模型进行检验,包括残差检验、异方差检验、自相关检验等,以确保模型的正确性和可靠性。
5. 利用拟合好的模型进行预测和分析。
例如,可以使用模型来预测多个时间序列的未来值,或者分析一个时间序列与其他时间序列之间的动态关系。
需要注意的是,VAR模型只适用于分析平稳时间序列数据,对于非平稳时间序列数据,需要进行差分、对数转换等处理使其平稳后再进行分析。
同时,VAR模型的假设和参数选择需要根据具体数据进行判断和选择,不同的模型适用于不同类型的数据和问题。
时间序列分析 向量自回归(VAR)模型

VAR(1)模型
26
Yt A1 Yt -1 Ut (I - L A 1) Yt Ut Yt (I - L A 1)-1 Ut Ut A1Ut-1 A12Ut-2 A1sUt-s 因此,VAR(k )可以写成一个无限阶的向量MA()
Yts Uts A1Uts-1 A12Uts-2 A1sUt
I
令 Yt (Yt ,Yt1,Yt2....Ytk1)NK1
C (c, 0, 0....0)NK1
1 2 ... k1 k
I
0 ...
0
0
A 0 I ... 0 0
...
... ...
...
...
0 0 ... I
0 NKNK
Ut ut
0
0 ... 0 NK 1
上式可写为 Yt C AYt1 Ut
• VAR模型是自回归模型的联立形式,所以 称向量自回归模型。
6
假设y1t , y2t之间存在关系, 若分别建立两个回归模型 y1,t f ( y1,t1, y1,t2 ,......) y2,t f ( y2,t1, y2,t2 ,......)
产生的问题是什么? 无法捕捉两个变量之间的关系 解决办法:建立两个变量之间的关系
14
注意的问题
• (1)因为L1=1/0.978 =1/1, L2 =1/0.27=1/2, 所以特征方程与相反的特征方程的根互为倒数,L = 1/ 。
• (2)在单方程模型中,通常用相反的特征方程
(L) = 0的根描述模型的稳定性,即单变量过程 稳定的条件是(相反的)特征方程(L) = 0的根
都要在单位圆以外;而在VAR模型中通常用特征
时间序列建模案例VAR模型分析报告与协整检验

传统的经济计量方法是以经济理论为基础来描述变量关系的模型。
但是,经济理论通常并不足以对变量之间的动态联系提供一个严密的说明,而且内生变量既可以出现在方程的左端又可以出现在方程的右端使得估计和推断变得更加复杂。
为了解决这些问题而出现了一种用非结构性方法来建立各个变量之间关系的模型。
本章所要介绍的向量自回归模型(vector autoregression ,VAR)和向量误差修正模型(vector error correction model ,VEC)就是非结构化的多方程模型。
向量自回归(VAR)是基于数据的统计性质建立模型,VAR 模型把系统中每一个内生变量作为系统中所有内生变量的滞后值的函数来构造模型,从而将单变量自回归模型推广到由多元时间序列变量组成的“向量”自回归模型。
VAR 模型是处理多个相关经济指标的分析与预测最容易操作的模型之一,并且在一定的条件下,多元MA 和ARMA 模型也可转化成VAR 模型,因此近年来VAR 模型受到越来越多的经济工作者的重视。
VAR(p ) 模型的数学表达式是t=1,2,…..,T其中:yt 是 k 维内生变量列向量,xt 是d 维外生变量列向量,p 是滞后阶数,T 是样本个数。
k ⨯k 维矩阵Φ1,…, Φp 和k ⨯d 维矩阵H 是待估计的系数矩阵。
εt 是 k 维扰动列向量,它们相互之间可以同期相关,但不与自己的滞后值相关且不与等式右边的变量相关,假设 ∑ 是εt 的协方差矩阵,是一个(k ⨯k )的正定矩阵。
11t t p t p t t --=+⋅⋅⋅+++y Φy Φy Hx ε注意,由于任何序列相关都可以通过增加更多的yt 的滞后而被消除,所以扰动项序列不相关的假设并不要求非常严格。
以1952一1991年对数的中国进、出口贸易总额序列为例介绍VAR 模型分析,其中包括;① VAR模型估计;②VAR模型滞后期的选择;③VAR模型平隐性检验;④VAR模型预侧;⑤协整性检验VAR模型佑计数据Lni(进口贸易总额), ,Lne的时间序列见图。
时间序列var模型过程

时间序列var模型过程
时间序列VAR(Vector Autoregression)模型是一种多变量时间序列分析方法,用于建模和预测多个相关变量之间的相互依赖关系。
下面是使用时间序列VAR模型的一般步骤:
1.数据准备:收集并准备时间序列数据,包括多个相关变量
的观测值。
2.确定滞后阶数(Lag order determination):使用一些统计
指标或信息准则(如AIC、BIC等)来选择合适的滞后阶数。
滞后阶数决定了VAR模型中包含的过去时刻的数据点数。
3.拟合VAR模型:使用选定的滞后阶数,拟合VAR模型。
VAR模型可以用矩阵形式表示为:
Y_t = c + A_1 * Y_(t-1) + A_2 * Y_(t-2) + ... + A_p * Y_(t-p) + error_t
其中,Y_t是一个包含所有相关变量的向量,A_1, A_2, ..., A_p 是与每个滞后阶数对应的系数矩阵,c是截距项,error_t是误差项,t表示时间。
4.模型诊断和评估:对拟合的VAR模型进行诊断和评估,包
括检查误差项是否满足白噪声假设、模型是否具有良好的
拟合度等。
5.可选的模型改进和优化:根据需要,可以进行模型的改进
和优化,如添加外生变量、考虑异方差性等。
6.模型应用和预测:使用训练好的VAR模型进行应用和预测。
可以利用拟合的VAR模型进行现有数据的推断或使用它进行未来数据点的预测。
需要注意的是,VAR模型对数据的平稳性和线性相关性有一定要求。
在使用VAR模型之前,可能需要进行平稳性检验和相关性分析,或者对数据进行差分或转换,以满足模型的要求。
常用的销量预测方法

常用的销量预测方法销量预测是企业经营中的重要环节,它能够帮助企业合理安排生产计划、制定市场营销策略以及调整供应链等相关业务。
在实际销售环境中,根据销售数据和市场环境,提供准确的销量预测是至关重要的。
下面我们将介绍一些常用的销量预测方法。
1. 时间序列分析(Time Series Analysis):时间序列分析是一种基于历史数据进行预测的方法,它假设未来的销量取决于过去的销量。
在实际应用中,可以运用ARIMA模型(AutoRegressive Integrated Moving Average)或者指数平滑法(Exponential Smoothing)来进行时间序列分析。
ARIMA模型将时间序列数据拆解成趋势、季节和残差三个部分,然后根据规律进行预测;指数平滑法则基于移动平均的方式进行预测。
2. 统计回归分析(Statistical Regression Analysis):统计回归分析是一种通过分析多个变量之间的关系来进行预测的方法。
它通常使用线性回归模型来建模并预测销量。
在建立回归模型时,除了历史销量数据外,还可以考虑其他因素,如市场规模、广告投入、季节性因素、竞争力等。
通过对这些因素的分析和建模,可以预测出销量和其他因素之间的关系,并在此基础上进行未来销量的预测。
3. 时间序列回归(Time Series Regression):时间序列回归是将时间序列分析和统计回归分析相结合的方法。
它基于时间序列数据和其他相关因素,建立回归模型进行预测。
与普通的回归分析相比,时间序列回归能够更好地考虑时间序列数据中的趋势和季节性变化。
常用的时间序列回归方法有ARIMAX模型(AutoRegressive Integrated Moving Averagewith eXogenous variables)和VAR模型(Vector Autoregressive model)等。
4. 人工神经网络(Artificial Neural Networks, ANN):人工神经网络是一种模仿人脑神经系统结构和工作原理的模型。
stata操作介绍之时间序列分析

时间单位
格式说明
Clocktime
daily weekly monthly quarterly harfyearly yearly generic format(%fmt) 时间周期
timevar的格式为%tc, 0=1jan1960 00:00:00.000,1=1jan1960 00:00:00.001 即0代表1960年1月1日的第一秒,1为1960年1月1日的第二秒,依次后推。 timevar的格式为%td,0=1jan1960,1=2jan1960;即0为1960年第一天,1 为1960年第二天,依次后推。 timevar的格式为%tw,0=1960w1,1=1960w2;即0为1960年第一周,1 为1960年第二周,依次后推。 timevar的格式为%tm,0=1,1=;即0为1960年第一月,1为1960年第二 月,依次后推。 timevar的格式为%tq,0=1960q1,1=1960q2;即0为1960年第一季,1为 1960年第二季,依次后推。 timevar的格式为%th,0=1960h1,1=1960h2;即0为从1960起的第一个半 年,1为从1960年起第二个半年,依次后推。 timevar的格式为%ty,1960=1960,1961=1960 timevar的格式为%tg
数据=修匀部分+粗糙部分,运用Stata进行修匀使用 tssmooth命令,其基本命令格式如下所示:
tssmooth smoother[type] newvar = exp [if] [in] [, ...]
其中平s滑mo的o种t类her[type]有一系sm列oo目ther录[ty,pe]如下表3所示:
var模型的主要原理及应用

var模型的主要原理及应用
4. 预测分析:VAR模型可以用于预测未来变量的走势。通过历史数据建立VAR模型,可以 利用模型的参数估计和滞后值来预测未来变量的值,提供决策者参考和预警。
总之,VAR模型通过自回归和向量的方式,可以分析多个变量之间的相互关系和影响,广 泛应用于经济学、金融学、政策分析和预测分析等领域。
var模型的主要原理及应用
VAR(Vector Autoregression)模型是一种多变量时间序列分析模型,主要用于分析多 个变量之间的相互关系和相互影响。其主要原理和应用如下:
主要原理: 1. 自回归(Autoregression):VAR模型基于自回归的概念,即每个变量的当前值可以 通过其过去时刻的值来预测。模型中的每个变量都可以被自身的滞后值和其他变量的滞后值 所解释。 2. 向量(Vector):VAR模型处理的是多个变量的联合行为,将这些变量构成一个向量 ,通过向量的方式来建模和分析。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Lecture 66. Time series analysis: Multivariate models6.1Learning outcomes•Vector autoregression (VAR)•Cointegration•Vector error correction model (VECM)•Application: pairs trading6.2Vector autoregression (VAR)向量自回归The classical linear regression model assumes strict exogeneity; hence, there is no serial correlation between error terms and any realisation of any independent variable (lead or lag). As we discovered, serial correlation (or autocorrelation) is very common in financial time series and panel data. Furthermore, we assumed a pre-defined relation of causality: explanatory variable affect the dependent variable・传统的线性回归模型假设严格的外主性,误差项与可实现的独立变量之间没有序列相关性。
金融时间序列及面板数据往往都有很强的自相关性,假定解释变量影响因变量。
We now relax bo什]assumptions using a VAR model. VAR models can be regarded as a generalisation of AR(p) processes by adding additional time series. Hence, we enter the field of multivariate time series analysis. VAR模型可以'"l作是在一般的自回归过程中加入时间序列。
Lefs look at a standard AR(p) process for hvo variables (y( and xj・(1)%= Ql + 琅]仇『一 +仏(2)x t = a2 + - + £2tThe next step is to allow that lagged values of xt can affect y( and vice versa. This means that we obtain a system of equations for two dependent variables(y(and xj・Both dependent variables are influenced by past realisations of y(and x t. By doing that, we violate strict exogeneity (see Lecture 2); however, we can use a more relaxed concept, namely weak exogeneity・As we use lagged values of bodi dependent variables, we can argue that these lagged values are known to us, as we observed them in the previous period・ We call these variables predetermined・ Predetermined (lagged) variables fulfil weak exogeneity in the sense that they have to be uncorrelated with the contemporaneoiis error term in t・ We can still use OLS to estimate the following system of equations, which is called a VAR in reduced form.(3)+y 仇1化_丫+sr=i ^12 +£it(4)X t = a2+2X1021”—, + _i + f2tTlie beauty of tliis model is that we don't need to predefine whether x or y are endogenous (the dependent variable). In fact, we can test whether x (y) is endogenous or exogenous using Granger causality tests・The idea of Granger causality is that past observations (lagged dependent variables) can influence cuiTent observations — but not vice versa・ So the idea is rather simple: the past affects the present, and the present does not affect the past. STATA provides Granger causality tests after conducting a VAR analysis, which is based on testing the joint hypothesis that past realisations do not Granger cause the present realisation of the dependent variable.In many applications, VAR models make a lot of sense, as a clear direction of causality cannot be predefined・For instance, there is a substantial literature on the benefits of internationalisation (e.g. entering foreign market through cross-border M&A). There is evidence that multinationals outperform local peers due to the benefits of operating in many countries. At the same time, we know that high-performing companies are more likely to enter foreign markets due to their ownership specific advantages. This argument is based on the Resource-based View and the OLS framework developed by Dunning and Rugman (Reading School of International Business). The VAR model allows you to incorporate both effects: in fact you can test whether performance drives internationalisation or internationalisation drives performance.Before you start using a VAR modeL you have to make sure that the time series are stationary. So the first step is to check whether the time series is sStionjry using Dickey-Fuller tests and KPSS tests. The second step is to specify the optimal lag length (p) of the model. This is done by comparing different model specifications using information criteria. Apart from using Akaike (AIC) and Bayesian Schwarz (BIC), the Hannan-Quinn (HQIC) is commonly used. Most applied econometricians favour the Hannan-Quinn (HQIC) criterion・ STATA will help you to make a good choice・ After specifying your model, you need to check stability conditions. The coefficient matrix of the reduced form VAR has to ensure that the iteration sequence converges to a long-term value・ STATA will help you in checking stability.To be precise, you need to show that the eigenvalues of the coefficient matrix lie within the unit circle. The reason behind it can be only understood when you understand the method of diagonalizing a matrix.VAR models offer ano 什nice feature: impulse response functions・ VAR models capture the dynamics of two (or more) stationary time series; hence, we can assess the dynamic impact of a marginal change of one variable on another・ The standard OLS regression provides coefficients, and coefficients refer to the partial impact of an explanatory variable on the dependent variable ・ In the case of VAR models, the relationship becomes dynamic, as a change of one variable (say x) in t can affect x and y in t+l・ The impact on x and y in t+1 in turn affects x and y in t+2 and so on until the impact dies out. Impulse response functions are very useful in illustrating the short-term dynamics in a model.Lefs look at an example to see how VAR modelling works. In Lecture 5, we tried very hard to understand gold prices・ We extend our univariate model by exploring the relationships betweengold and silver prices・Linking two (similar) assets or securities is a very common trading strategy, which is called pairs-tradin^・Before we do any sophisticated modelling, it is always beneficial to look at some line charts. Figure 1 shows the indexed time series of nominal gold and silver prices from 1900 to 2010. Figure 1: Nominal gold and silver prices, indexed^ 1900-2010We can see that there is a certain degree of co-movement, which we might be able to exploit for our trading strategy. Before we can use VAR. we need to ensure that both time series are stationary. It is obvious from Figure 1 that gold and silver prices are not stationary. However, after taking a first-difference we can show that price changes are stationary. So both time series are 1(1).The next step is to determine the optimal lag length using information criteria・ Table 1 shows different specifications using the varsoc command・Table 1: Determining the optimal lag length using information criteriaSelection-order criteriaSample: 1906 - 2010 Number of obs = 105Endogenous: return.g return_s Exogenous: _consBased on the AIC and HQIC, two lags are optimal; however, the (S)BIC prefers only one lag. I would prefer HQIC and try two lags first. If the second lag does not exhibit significant coefficient, we could try to reduce the lag leng什】in line with (S)BIC・We run a VAR with two lags to explain current price changes in gold and silver・ Table 2 provides the OLS estimates.Table 2: VAR model with two lagsVector autoregressionSample: 1903 - 2010Log likelihood = 126.0166N0・ of obs AICHQICSBIC= 108 =・2・148455 =・2・04776 = ・丄・90OilFPEDet(Sigma_ml) Equation = ・0004=・00OM323Parms RMSE R-sq chi2P>chi2return.g5・1269270.242534.57860.0000return_s5・1965690.130616.227630・0027coef.Std・ Err. 2 P>|Z|[95% Conf.Interval]return_greturn.gLl・・4864107•丄2298563・960.000・2453633・7274581L2・-・0139809・122817-0.110・ 909-.2546979・2267361return.sL:L-・0068126•0805903-0.080.933-・1647668・1511415L2・■・207786・0807151-2.570.010-.3659847■・0495874_cons・0277213・0124857 2.22O・O26・0032497・0521929return_s return^gLl・・3143786・1904648 1.650.099-.0589257・6876828L2・・1085011・19020380.570.568-・2642915・4812937return.sLl・・1094293・12480830・880.381-.1351905・354049L2・-・3201805・1250015-2.560.010-.5651789■・0751821_cons・024511.0193363 1.270・ 205-.0133875・0624095We see that silver prices (lag 2) affect current gold prices, and we can establish autocorrelation in both time series・ To test whether gold Granger causes silver or vice versa, we run Granger causality tests reported in Table 3.Table 3: Granger causality testsHence, we confirm that past changes in silver prices can predict future gold price changes. This is very interesting, as it can be used to develop a trading strategy. Finally, we need to show that the VAR is stable (see Table 4).Table 4: Stability condition of the VAR・Finally, we can illustrate the impact of silver price changes on future gold price changes using an impulse response function・ Figure 2 shows the impulse response function and confidence intervals derived from bootstrapping. If silver prices increase today by 1%, we should expect a significant decline in gold prices in two years by 0.2%・Figure 2: Impulse response functionr, return_s, return_g 2・・.4T0 2 4 6 8step95% Cl ---------------- impulse response function (irf)Graphs by irfname, impulse variable, and response variable6.3CointegrationWhen we explore Figure 1 a bit more carefully, we can see that silver and gold prices exhibit a certain degree of co-movement. We could almost argue that they share a common stochastic trend・ The limitation of ARIMA and VAR models is that they can be only used if the time series are stationary. In our case, we had to first-difference your time series to ensure stationarity. First-differencing eliminates a lot of information in the time series・ Is there no better way to analyse gold and silver prices.Long before the development of multivariate time series econometrics, people realised that gold and silver seem to have a common movement around a long-term equilibrium (goldsilver price ratio). Moreover, the idea of equilibrium conditions in economics and the availability of macroeconomic time series led to the development of cointegration analysis.The idea is very simple. Even if two (or more) time series are non-stationary and hence have stochastic trends, they might be still driven by the same underlying factors that lead to their stochastic behaviour. Therefore, we analyse the time series in levels and see whether we can find a long-term equilibrium 一a so-called cointegrating vector.Before we explore the Johansen procedure, lefs look at the gold-silver ratio over time shown in Figure 3.Figure 3: The gold-silver ratio, 1900-2010The ratio looks like a meanprocess^ thus, in the long run it tends to go back to its long-term equilibrium (mean). Based on the ratio, we could argue that gold seems to be overvalued compared to silver at the moment.Of course, taking the ratio suggests a very simple cointegrating vector一in fact we assume a one-to-one relationship・ Before we can use the Johansen procedure, we have to make sure that the time series have the same order of integration I(p)・ We already know that gold and silver prices are both 1(1) time series・ Table 5 shows the results of the Johansen test for cointegration. In line with the VAR model, we use two lags.Table 5: Johansen test・ johans price.g pricers, lags(2)Johansen-Juselius cointegration rank test Sample: 1901 to 2010Number of obs = 109Hl:HO:Max-lambda TraceEigenvalues rank<=(r)statistics statistics(lambda)r(rank<=(r+l))(rank<=(p=2))・117631260JL3・ 64083122・240287・0758622118・59945658.5994565Osterwald-Lenum Critical values (95% interval):Table/Case: 1*(assumption: intercept in CE)HO:Max-lambda Trace015.6719.9619.249.24Table/Case: 1(assumption: intercept in VAR)HO:Max-lambda Trace014.0715.4113・763・76Normalized Beta'price.g price.s vecl -1・549e-07 ・0000176vec2 4・183e-O7 ・・ 00001694Normalized Alphavecl vec2price_g 69248 ・ 321 447701・12price_S -5468・ 4015 14662・ 5 54The null hypotllesis that there is no cointegration (r=0) can be rejected if we use the trace statistic. However, the null hypothesis that we have one cointegrating vector (r=l) cannot be rejected・ The problem is that the max-lambda statistic does not support cointegration・ I also tried log-prices instead, which is common in analysing gold-silver ratios; however, I don't obtain clear results・Given the extreme increase in volatility in prices, it might be likely that there are structural breaks in an alleged cointegration vector・ Structural breaks are difficult to handle・Another way to look at this problem is to test whether price ratios or log-price ratios are stationary time series・ If they are stationary, then the two underlying time series are cointegrated and the ratio indicates the cointegration vector. Again Dickey-Fuller tests cannot reject the null hypothesis: hence, both ratios don't seem to be stationaiy・6.4 Vector error-correction model (VECM)The VECM combines VAR and cointegration into one framework. The VAR is extended by including deviations from the long-term equilibrium defined by the cointegration vector ・ The coefficient of the deviation from the long-term equilibrium indicates the speed of adjustment back into cquilibrium.The VECM capture the long-term relationship and the short-term dynamics of two or more time series ・ Lefs see how it works in the case of gold and silver prices ・ Table 6 reports the VECM specification, which resembles the VAR with two lags. It also contains the CE component; the co-called erro 「correction component that captures the deviation from the long-term equilibrium in the previous period. So the CE is a lagged and hence predetermined variable, as required by OLS and the VAR framework ・ Table 6: VECM based on gold and silver pricesvector error-correction model The speed of adjustment is not significant, which undermines the idea of a long-run equilibrium in gold and silver prices as suggested by the literature ・We can explore structural changes, when we plot the predicted long-term equilibrium over time.Coef.Std ・ Err.2 P>|2| [95% conf. Interval]D_price_g _cel Ll.・-・0048672・0135324 -0.36 0.719 -.0313903 ・0216559price_g LD ・・2714343 ・23846821・14 0.255 -.1959548 .7388233 L2D ・ ・8565381 .2351755 3・64 0.000 ・3956026 1.317474 price.sLD ・・56377846・586781 0.09 0.932 -12.34607 13・47363 L2D ・ -26.23471 5・670113 -4.63 0.000 -37.34793 -15.1215 _cons2813・244472046.20.010.995-922380.4928006・9D_price_s _cei Ll・・0005916・0004392 丄・35 0.178 -・0002693 ・0014524 price_gLD ・-・0076263 ・0077399 -0.99 0.324 -.0227962 ・0075436 L2D ・ .0357519・007633 4・68 0.000 ・0207914 ・0507123 pricersLD ・・2898047 ・2137855 1.36 0.175 -・1292072・7088166 L2D ・ ■l ・064965・1840335-5.79 0.000 425664 ■・7042665_cons23146・2915321・091.510.131-6882・48753175・08D_price_g D_price_s6 5e+O6 0・2949 42・66373 0.0000 649748・20・259835・79424 0.0000Sample:1903 - 2010Log likelihood = -2911.494 Det(Sigma -.ml) =8・ 93e+2O No. of obs AIC HQIC SBIC10854.15731 54・28821 54・48015EquationParmsRMSE R-sq chi2P>chi2Figure 4: Predicted long-term equilibrium based on VECMIt is very obvious that the long-term equilibrium undergoes structural breaks. We could split the time period into a stable and unstable period. Yet the main issue with stiuctural breaks is that they appear to be obvious ex post 一but nearly impossible to predict ex ante・For instance, if we focus on 1900-1980, we obtain a very strong result that underlines cointegration and adjustments into the long-term equilibrium. Hence, we conclude that the gold-silver ratio is no longer a reliable phenomenon that we could rely on. Nevertheless, we can use the short-term dynamics captured in the VAR to do short-term trading.6.5Pairs trading • APPLICATIONThe idea of pairs trading is that we trade two similar shares that are driven by similar macroeconomic factors. In our example, we focus on the US steel industry and try to identify a trading strategy based on United States Steel Corporation and Titan International・First we need to modify the time dimension, as NASDAQ reports the latest share prices first. We selected 5-years of daily closing prices for our analysis・♦Time dimension needs to be modifledgen t=_nreplace t=1264-ttsset t ♦Line chart twoway (line us_steel t) (line titan t)Lef s have a quick look at a line chart combining both share prices・ Obviously both shareprices are non-stationary, which we should confirm first using Dickey-Fuller tests.We run Dickey-Fuller tests based on share prices and first-differenced time series・ The tests confirm that both time series are 1(1). Hence, we can try to find a cointegration relation following the Johansen procedure・ Before we do that, I suggest that we explore a VAR model and determine the optimal lag structure.♦Returnsgen r_us=ln(us_steel)-ln(_steel)gen r_titan=ln(titan)-ln(Ltitan)♦Dickev-Fullerdfuller us_steeldfuller titandfuller r_usdfuller r_titan・ varsoc r_us r_titanSelection-order criteriaWe cannot establish any VAR lag structure, which shows that there is hardly any serial-correlation of returns. This is great news for the Efficient Market Hypothesis 一but bad news for us. When you explore AC and PAC function, you will also discover that univariate analysis won't go anywhere, as autoconelation ill retiuns is not present・Luckily, we can find cointegration with Titan adjusting back to long-term equilibrium conditions・ Based on the VECM, we can predict the levels (share prices) of both stocks. These are one-step ahead forecast.When should you buy and sell? This also depends on transaction costs・ In pairs trading, you go long in one stock and short in the second stock to hedge your position. We need to avoid that we have to trade too frequently to reduce transaction costs.The following figure cumulates the deviations from the long-term equilibrium and shows periods of over an undervaluation・sum_us --------------- sumjitanIn practice, you would run different scenarios and determine losses and profits from following different trading rules. Moreover, you need to test your model out-of-sample to ensure that it holds・ Currently, we assume that we update the model every day, which is not necessarily the case・6.6.1 Interpretation of VECMInterpret the following VECM result ・ In particular, discuss whether there is a long-term equilibrium between gold and silver prices and highlight the short-term dynamics.・ vec price.g price.s if year<i980f 1ags(3)vector error-correction model Sample: 1903 - 1979 R-sq NO ・ of obs AIC HQIC SBIC77 48・53184 48・69011 48.92754Log likelihood Det(Sigma_m1) Equation =-1855.476=2.92e+18Parms RMSE chi2 P>chi2 D.price_g 6 261962 0.7932 272.3557 0.0000 D price s 614526.70.6356123.85180.0000coef.Std ・ Err.2 P>|2|[95% conf. Interval]D_pri"_g-celLl. ・1035065・01034710.000.000・0832269・1237862 price.gLD ・ l ・091987 ・14491037・54 0.000 ・807968 :L ・ 376006L2D ・ ・2523371・ 16181.560.119■・064785•5694592price sLD ・ -25.739185.458489 -4.72 0.000 -36.43762 -15・04074 L2D ・ -46.293325.561025 -8.32 0.000 -57.19272 -35.39391 _cons20.6136532031・290.000・ 999■62759.5662800・79D price s-celLl ・ ・0 027341.・00057386.510.000・0026095・0048587 price_gLD ・ ・0485741. ・0080358 6.04 0.000 •0328242 ・064324 L2D ・ ・0282756・00897243.150.002・0106901 ・0458612price sLD ・ 444845 ・3026928 -4.77 0.000 -2.038112 -.851578 L2D ・ ■I.690503 ・3083788-5.48 0.000 -2・294914 ■l ・086092 _cons-571.39381776.25-0.320.748-4052.782909・992Cointegrating equationsEquation Parmschi 2 P>chi2_cel166・845840.0000Identification: beta is exactly identifiedEnders, W. (2004) Applied econometric time series. 2nd edition, John Wiley & Sons.。