Вы находитесь на странице: 1из 64

VAR-VECM

diagnostics
examples and simulations
in Stata

689: Statistical Methods


for Finance
Spring 2008
Charles Lindsey
1
Table of Contents
1. Introduction
1. VAR Model
2. VECM Model
3. Stata
2. VAR diagnostics
1. Lag Order Selection
1. LR Test
2. Information Criteria
2.Whiteness of Residuals
1. Portmanteau Test
2. LaGrange Multiplier Test
3. Normality of Residuals
4. Stability Test
3. VECM diagnostics
1. Rank of Cointegration
2
1 Introduction
Project Motivation :
My first VAR model –

3
1 Introduction
Modeled attention to the climate change issue in
congressional and media settings.
Endogenous (VAR terms)
MA Media Attention
CA Congressional Attention
Exogenous (Covariates)
NKL Net Keeling Level
CEI Climate Extreme Index
IFE International Focusing Events
NSP Net Scientific Publications

4
1 Introduction
This was actually a VARX model
(a VAR with independent variables independent of
the errors)

But many of the VAR diagnostics applied.

5
1 Introduction
VAR
output

6
1 Introduction
Lag
Order
Selection

7
1 Introduction
Residual
Whiteness

8
1 Introduction
Stability

9
1 Introduction
Normality
Of Residuals

10
1. Introduction
Fitting model with Stata was interesting and
straightforward.

Found Helmut Lütkepohl’s excellent book :


New Introduction to Multiple Time Series
Analysis

11
1.1 VAR Model
VAR process of order p

- yt is a k x 1 random vector
- the Ai are k x k fixed coefficient matrices
- v is a k x 1 fixed vector of intercept terms
- ut is a k x 1 random vector,
a white noise or innovation process.

12
1.1 VAR Model
ut is a white noise process iff
- E ut = 0
- E utut' = (nonsingular)
- E utus' = 0 if s ≠ t

We can make two additional assumptions.

- If ut is Multivariate Normal,
then yt is a Gaussian Process

13
1.1 VAR Model
- If |Ik – A1 z – … – Ap z p| ≠ 0
for complex z , |z| < 1
then yt is a stable VAR(p) process

We will make these two additional assumptions


when we discuss a generic VAR(p) model.

14
1.2 VECM Model
When the stability condition is not satisfied,
We may still analyze the process

Let yt is a k x 1 random vector

yt ~ I(d) (integrated of order d)


if Δd yt is stable
but Δd-1 yt is not

15
1.2 VECM Model
yt ~ I(d) is cointegrated
if there exists k x 1 fixed vector β ≠ 0
so β'yt is integrated of order < d
(I(0) stable)

We say yt ~ CI(d)

16
1.2 VECM Model
VECM process of order p

- yt is a k x 1 random vector, ~ CI(1)


- Π k x k fixed cointegration matrix
- the Гi are k x k fixed coefficient matrices
- ut is a k x 1 white noise process.

Additionally, we assume that ut is Gaussian

17
1.3 Stata
Stata is a statistical software package
- Fast
- all data stored in RAM
- Accurate
- I worked there, trust me
- Intuitive & Simple Syntax
- Broad Functionality
- Excellent Graphics and Text Display capabilities

18
1.3 Stata
Stata has Powerful Time Series functionality

It implements much of what Lütkepohl found


important

19
2 VAR diagnostics
If we fit a VAR model and all of the assumptions are
not met :

The inference we make using the model may be


erroneous.

Just like in linear regression, there are consequences


(maybe dire) for using estimates from a flawed
model.

20
2 VAR diagnostics
Diagnostics help us check that the assumptions of our
model are met.

The diagnostics for VAR models that we discuss are


not exhaustive, but they comprise most of what
Lütkepohl suggests

21
2.1 Lag Order Selection
Determination of p such that
Ai = 0 for all i > p in the VAR model.

So we are finding the index of the most lagged value


of yt that should contribute to the current value.

We may take one of two approaches


- Select based on LR Test
- Select based on Information Criteria

22
2.1.1 LR Test
Consider the first option. First find an upper bound
on the lag order, M.

Test the following until rejection.

H01 : AM = 0 vs H11 : AM ≠ 0
H02 : AM-1 = 0 vs H12 : AM-1 ≠ 0 | AM = 0

H0i : AM-i+1 = 0 vs H1i : AM-i+1 ≠ 0 | AM = … = AM-i+2 = 0

H0M : A1 = 0 vs H1M : A1 ≠ 0 | AM = … = A2 = 0

23
2.1.1 LR Test
When H0i is the first hypothesis rejected, we choose
the lag order to be M-i+1.

Let be the mle of when we fit a VAR(m)


model to yt and the yt process has length T.

To test H0i, we use the simplified l. r. statistic,

24
2.1.1 LR Test
Under the assumption that H0i and all previous null
hypotheses are true,

Rejection of lower indices of H0i implies rejection of


higher indices.

So the individual test and procedure wise Type I


error probabilities differ.

25
2.1.1 LR Test
Let γi be significance level used for the individual
test of

The actual probability of Type I error for the jth test


in the sequence is
εj = 1 - (1 - γ1 ) *… *(1 - γj)
(Paulsen and Tjostheim, 1985)

So the actual Type I error rate explodes as the


sequence of null hypotheses gets long.
26
2.1.1 LR Test
Stata allows access to the mle of the error variance
after fitting a VAR.

A program will be written to implement this testing


algorithm.

The explosion of Type I Error will be documented


with a simulation.

27
2.1.2 Information Criteria
In linear regression, we do not always pick the model
with the lowest RSS.

Redundant predictors bloat the variance of estimates,


and counterbalance the extra predictive power
they bring to the model.

We have a similar situation in lag order selection.

28
2.1.2 Information Criteria
More lags mean more parameters to estimate.

This leads less biased but more variant predictions.

We try to find a lag order estimate that does not


sacrifice the precision of the model for accuracy.

Using Information Criteria as lag order selection


“values” will help us.

29
2.1.2 Information Criteria
The final prediction error (FPE) criterion measures
the mean square error (MSE) of the 1-step ahead
forecast

We adjust to make it unbiased and then take


the determinant.

30
2.1.2 Information Criteria
Akaike’s Information Criterion may also be used for
lag order selection.

This may be interpreted as usual,


(- Log likelihood of parameters) +
(penalty term for # parameters)

31
2.1.2 Information Criteria
There are two additional criteria of interest.

The Hannan & Quinn (1979) criterion is similar to


AIC, but uses a larger penalization for extra
parameters

32
2.1.2 Information Criteria
Schwarz (1978) used Bayesian arguments to derive
the SC criterion.

33
2.1.2 Information Criteria
The different information criteria are related.

Both HQ and SC are strong consistent for the true lag


order.

AIC and FPE asymptotically overestimate the true


lag order with positive probability.
But in both small and large samples they may
produce better forecasts.

34
2.1.2 Information Criteria
Stata provides each of the information criteria
through varsoc

Ex.

We will compare the information criteria via


simulation using varsoc.

35
2.2 Whiteness of Residuals
The ut error process of a VAR(p) model is unknown.
We estimate it with the observed residuals .

Using , there are two tests commonly used for


testing the autocorrelation restriction of the ut.

Tests of the other whiteness properties are possible as


well, but we will not focus on these.

36
2.2.1 Portmanteau Test
The Portmanteau test jointly tests the significance of
all error autocorrelations up to a set order, h.

Define Ri as the autcorrelation matrix for lag i among


the errors.

H0 : Rh = (R1,…, Rh) = 0 against


H1 : Rh ≠ 0

37
2.2.1 Portmanteau Test
is the estimated autocorrelation of lag i.

is the estimated correlation matrix of ut.

Test statistic for Portmanteau test

38
2.2.1 Portmanteau Test
For large T and h, under H0

Stata implements the Portmanteau test through the


user written command wntstmvq.

39
2.2.2 LaGrange Multiplier Test
This test was developed by Breusch and Godfrey in
1978.

Assume a VAR model for the error

To test autocorrelation in ut, we test

H0 : D1 = … = Dh = 0 against
H1 : Dj ≠ 0 for at least one j < h

40
2.2.2 LaGrange Multiplier Test
We use the LaGrange Multiplier method to perform
the test.

This method is very useful for finding optimal


estimates under constraint conditions. See
Hocking (2005) for further info.

Under H0 we only need to estimate the regular VAR


model (ut= vt). So the constrained case estimates
are simple.

41
2.2.2 LaGrange Multiplier Test
To determine the test statistic we begin with the
auxiliary regression model

where

42
2.2.2 LaGrange Multiplier Test
Define Fi such that

then

This yields the least squares estimate of D

43
2.2.2 LaGrange Multiplier Test
The standard test statistic for testing whether D =
0 (no autocorrelation) is

Under H0

44
2.2.2 LaGrange Multiplier Test
Stata implements the LaGrange Multiplier test
through the varlmar command.

Ex.

We will test this command and compare it with the


portmanteau test command using simulation.

45
2.3 Normality of Residuals
Lütkepohl suggests using the multivariate
generalization of the Jarque-Bera test (Jarque &
Bera 1987) on to test the multivariate
normality of the ut.

This tests the skewness and kurtosis properties of the


ut (3rd & 4th moments) against those of a
multivariate normal distribution of the
appropriate dimension.

46
2.3 Normality of Residuals
It is possible that the first four moments of the ut
match the multivariate normal moments, and the
ut are still not normally distributed.

It is hoped that most of the “normal” properties


desired by the model fitter in the ut are met by
these four moments.

47
2.3 Normality of Residuals
This situation has an analog in linear regression. We
assume that the errors are independent, but we
can only test whether they are correlated.

In linear regression, it is adequate to test the


correlation of the residuals. If they are
uncorrelated, that is enough “independence” for
getting the variance calculations correct. We
don’t worry about the other forms of
dependence.

48
2.3 Normality of Residuals
Our formulaton of the Jarque-Bera test uses a mean
adjusted form of the VAR(p) model, but it
applies to our general form in section 1.2.

49
2.3 Normality of Residuals

Now we define the standardized residuals and their


sample moments

50
2.3 Normality of Residuals
Finally our test statistics are

The third and fourth moments of ut should be 0 and


3.

51
2.3 Normality of Residuals
Under the third moment assumption

Under the fourth moment assumption

Under both assumptions

52
2.3 Normality of Residuals
So all three test statistics may be used to test the
multivariate normality of ut.

Stata implements these tests using varlnorm. We


will test this using simulation on normal and
non-normal noise data.

53
2.3 Normality of Residuals

Ex.

54
2.4 Stability Test
Checking that a VAR(p) process is stable, that

|Ik – A1 z – … – Ap z p| ≠ 0
for complex z , |z| < 1

Is fairly straightforward. We merely find all the roots


of |Ik – A1 z – … – Ap z p|, plugging in the
estimates of the Ai.

55
2.4 Stability Test
Stata uses the varstable command to perform this
task.

Roots of the companion matrix

1
.5
Imaginary
0-.5
-1

-1 -.5 0 .5 1
Real

56
3 VECM Diagnostics
Many VECM diagnostics are very similar to those of
VAR.

We will not discuss or investigate these overlapping


diagnostics.

This leaves us discussing one diagnostic.

57
3.1 Rank of Cointegration
The coefficient matrix for yt-1 , Π = αβ' where

α k x r loading matrix
β r x k cointegration matrix

The columns of β, βi are such that βi'yt


is stable.

58
3.1 Rank of Cointegration
When we find the rank of cointegration, we are
finding r = rank(Π), the number of cointegrating
vectors βi.

For brevity, we will investigate testing the rank under


the simple model with no deterministic terms.
(no intercept, linear trend in t, etc.)

We originally specified our VECM models in this


way.

59
3.1 Rank of Cointegration
Let l(ri) be the maximum of the likelihood of the
VECM model under cointegration rank ri
(similar to profile likelihood)

The λi are the ordered eigenvalues of a particular


(and complicated) matrix used in the ML
estimation of the VECM
60
3.1 Rank of Cointegration
Under H0 : rank(Π) = r0 , the asymptotic distribution
of is not χ2 or any familiar.

Johansen (1988,1995) considered two cases

H0 : rank(Π) = r0 vs r0 < rank(Π) ≤ k

H0 : rank(Π) = r0 vs rank(Π) = r0 + 1

61
3.1 Rank of Cointegration
The test statistic for the first is called the
trace statistic

The test statistic for the second is


called the maximum eigenvalue statistic.

Let W be a k-r0 dimension standard Wiener process.

62
3.1 Rank of Cointegration

Johansen found that under H0 : rank(Π) = r0

63
3.1 Rank of Cointegration
The addition of trend terms to the VECM model for
cointegration rank testing involves slight
modifications to what we discussed.

As time allows, certain types of trends will be added


to the project’s investigation.

Stata supports cointegration rank testing through the


vecrank command.

64

Вам также может понравиться