Page 1 of 1

VAR, Cross Equation Tests

Posted: Sun Nov 23, 2014 1:22 am
by fan
Hi Tom,

Suppose I have the following VAR model with a lag of 1 as such .

y_t = A + a1 y_t-1 +b1 x_t-1 + e1t
x_t = B + c1 y_t-1 + d1 x_t-1 + e2t


If I need to do the joint F-tests of the significance on A and B, a1 and c1, and b1and d1 respectively. How can I do it?

Code: Select all

system(model=varmodel)
vars y x
lags 1
det constant
end(system)
estimate(coef=coef)

exclude
# coef(1,1) coef(1,2)

exclude
#coef(2,1) coef(2,2)

exclude
#coef(3,1) coef(3,2)

I got the error message
## SX22. Expected Type INTEGER, Got REAL Instead
>>>># coef(1,1) <<<<
Could you please let me know what I did wrong? Many Thanks

Re: VAR, Cross Equation Tests

Posted: Mon Nov 24, 2014 8:12 am
by TomDoan
Isn't that addressed in the section on Hypothesis Tests in the VAR Chapter of the User's Guide? If you want to a Wald test (rather than LR test), you can do a SUR estimate instead.

Re: VAR, Cross Equation Tests

Posted: Mon Nov 24, 2014 1:14 pm
by fan
TomDoan wrote:Isn't that addressed in the section on Hypothesis Tests in the VAR Chapter of the User's Guide? If you want to a Wald test (rather than LR test), you can do a SUR estimate instead.
Hi Tom, Thank you for your quick reply. Could you please kindly check my code to see whether the code are for the tests I would like to do? Many Thanks

Code: Select all

CALENDAR(M) 1926:7
DATA(FORMAT=XLSX,ORG=COLUMNS,SHEET="sample") 1926:07 2014:09 const y x

lin(define=eq1) y
# const y{1} x{1}
lin(define=eq2) x
# const y{1} x{1}
sur(coef=beta) 2
#eq1; #eq2



group example eq1 eq2
exclude
#1

exclude 
#2

exclude
#3

Re: VAR, Cross Equation Tests

Posted: Mon Nov 24, 2014 1:26 pm
by TomDoan
No. You can't do an EXCLUDE after a SUR (since the regressors aren't necessarily unique). You need to do TEST(ZEROS) instead. And

TEST(ZEROS)
# 1

only tests the first coefficient in the model as a whole, not a joint test of both. You would need

TEST(ZEROS)
# 1 4

for that, and similarly for the other tests. (BTW, the GROUP instruction has no effect---everything will be based upon the SUR instruction that you already did).

Re: VAR, Cross Equation Tests

Posted: Mon Nov 24, 2014 1:40 pm
by fan
TomDoan wrote:No. You can't do an EXCLUDE after a SUR (since the regressors aren't necessarily unique). You need to do TEST(ZEROS) instead. And

TEST(ZEROS)
# 1

only tests the first coefficient in the model as a whole, not a joint test of both. You would need

TEST(ZEROS)
# 1 4

for that, and similarly for the other tests. (BTW, the GROUP instruction has no effect---everything will be based upon the SUR instruction that you already did).
Thank you so much. It worked

Re: VAR, Cross Equation Tests

Posted: Mon Mar 09, 2015 12:33 am
by fan
TomDoan wrote:No. You can't do an EXCLUDE after a SUR (since the regressors aren't necessarily unique). You need to do TEST(ZEROS) instead. And

TEST(ZEROS)
# 1

only tests the first coefficient in the model as a whole, not a joint test of both. You would need

TEST(ZEROS)
# 1 4

for that, and similarly for the other tests. (BTW, the GROUP instruction has no effect---everything will be based upon the SUR instruction that you already did).
Hi Tom, could you please help me understand why I am getting the following error messages ?

Null Hypothesis : The Following Coefficients Are Zero
OPP Lag(s) 0
## X13. Redundant Restrictions. Using 14 Degrees, not 25
Chi-Squared(14)= 40620.992453 or F(14,*)= 2901.49946 with Significance Level 0.00000000


Null Hypothesis : The Following Coefficients Are Zero
SENTI Lag(s) 0
## X13. Redundant Restrictions. Using 17 Degrees, not 25
Chi-Squared(17)=2451868.063198 or F(17,*)= 144227.53313 with Significance Level 0.00000000


OPP and SENTI are two explanatory variables. I do not understand why for OPP the program uses 14 degree but for SENTI the program uses 17 degree. Thank you in advance.
Here are my codes

Code: Select all

linreg(def=1) r11
# constant mkt opp senti
linreg(def=2) r12
# constant mkt opp senti
linreg(def=3) r13
# constant mkt opp senti
linreg(def=4) r14
# constant mkt opp senti
linreg(def=5) r15
# constant mkt opp senti
linreg(def=6) r21
# constant mkt opp senti
linreg(def=7) r22
# constant mkt opp senti
linreg(def=8) r23
# constant mkt opp senti
linreg(def=9) r24
# constant mkt opp senti
linreg(def=10) r25
# constant mkt opp senti
linreg(def=11) r31
# constant mkt opp senti
linreg(def=12) r32
# constant mkt opp senti
linreg(def=13) r33
# constant mkt opp senti
linreg(def=14) r34
# constant mkt opp senti
linreg(def=15) r35
# constant mkt opp senti
linreg(def=16) r41
# constant mkt opp senti
linreg(def=17) r42
# constant mkt opp senti
linreg(def=18) r43
# constant mkt opp senti
linreg(def=19) r44
# constant mkt opp senti
linreg(def=20) r45
# constant mkt opp senti
linreg(def=21) r51
# constant mkt opp senti
linreg(def=22) r52
# constant mkt opp senti
linreg(def=23) r53
# constant mkt opp senti
linreg(def=24) r54
# constant mkt opp senti
linreg(def=25) r55
# constant mkt opp senti
sur(robust, lags=5) 25 /
# 1 1 
# 2 2 
# 3 3 
# 4 4 
# 5 5
# 6 6 
# 7 7 
# 8 8
# 9 9
# 10 10
# 11 11
# 12 12
# 13 13
# 14 14
# 15 15
# 16 16
# 17 17
# 18 18
# 19 19
# 20 20
# 21 21 
# 22 22
# 23 23 
# 24 24
# 25 25
test(zeros)
# 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97
test(zeros)
# 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 86 90 94 98
test(zeros)
# 3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63 67 71 75 79 83 87 91 95 99  
test(zeros)
# 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100

Re: VAR, Cross Equation Tests

Posted: Mon Mar 09, 2015 7:59 am
by TomDoan
Note that you could have done this quite a bit more easily with:

system(model=mymodel)
variables r11 r12 r13 ... r55
det constant mkt opp senti
end(system)
sur(model=mymodel)

where the ... would be replaced with the missing rxx series.

How much data do you have? It's possible that you're having a problem because you're trying to do the robust errors without enough data. You're also doing ROBUSTERRORS with LAGS without a lag window (such as LWINDOW=NEWEY) which could result in a non-positive definite covariance matrix.

Re: VAR, Cross Equation Tests

Posted: Mon Mar 09, 2015 6:44 pm
by fan
TomDoan wrote:Note that you could have done this quite a bit more easily with:

system(model=mymodel)
variables r11 r12 r13 ... r55
det constant mkt opp senti
end(system)
sur(model=mymodel)

where the ... would be replaced with the missing rxx series.

How much data do you have? It's possible that you're having a problem because you're trying to do the robust errors without enough data. You're also doing ROBUSTERRORS with LAGS without a lag window (such as LWINDOW=NEWEY) which could result in a non-positive definite covariance matrix.
Hi Tom, Thank you for the reply. I have monthly data from 1965:07 to 2010: 12, 546 observations. The three explanatory variables, mkt, opp and senti, are the three state variables I estimated from a state-space model. One thing I do not understand is that even I do not have enough data for the robust errors, why the program uses different degrees from different variables, such as 14 for opp and 17 for senti?

Re: VAR, Cross Equation Tests

Posted: Mon Mar 09, 2015 8:02 pm
by TomDoan
The non-positive-definiteness of the covariance matrix will affect different restrictions differently.

Re: VAR, Cross Equation Tests

Posted: Mon Mar 09, 2015 10:13 pm
by fan
TomDoan wrote:The non-positive-definiteness of the covariance matrix will affect different restrictions differently.
Thank you so much for helping my understand error message. You are very right about the non-positive definite covariance matrix issue. After using a lag window, everything works perfectly. Thank you once again.