Varma Garch

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 55

### Selected R commands and their output for Chapter 3 ###

> da=read.table("m-dec15678-6111.txt",header=T)
> head(da)
date dec1 dec5 dec6 dec7 dec8
1 19610131 0.058011 0.081767 0.084824 0.087414 0.099884
2 19610228 0.029241 0.055524 0.067772 0.079544 0.079434
3 19610330 0.025896 0.041304 0.055696 0.065426 0.069637
4 19610428 0.005667 0.000780 0.005113 0.022786 0.019822
5 19610531 0.019208 0.049590 0.047651 0.031453 0.047365
6 19610630 -0.024670 -0.040046 -0.058176 -0.056580 -0.054167
> x=log(da[,2:6]+1)*100 ## compute log returns, in percentages
> rtn=cbind(x$dec5,x$dec8) ## select Decile 5 and 8.
> tdx=c(1:612)/12+1961 ## create calendar time
> require(MTS) ## loag MTS package
> colnames(rtn) <- c("d5","d8")

> MTSplot(rtn,tdx)
> ccm(rtn,lag=6)
[1] "Covariance matrix:"
d5 d8
d5 30.7 34.3
d8 34.3 41.2
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.964
[2,] 0.964 1.000
Simplified matrix:
CCM at lag: 1
+ +
+ +
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
Hit Enter for p-value plot of individual ccm:
### Plot not shown

> VMAorder(rtn,lag=20)
Q(j,m) Statistics:
j Q(j,m) p-value
[1,] 1.00 109.72 0.02 <== VMA(1) identified
[2,] 2.00 71.11 0.64
[3,] 3.00 63.14 0.76
[4,] 4.00 58.90 0.78
[5,] 5.00 55.40 0.77
[6,] 6.00 55.20 0.65
[7,] 7.00 53.70 0.56
[8,] 8.00 53.05 0.43
[9,] 9.00 47.87 0.48
[10,] 10.00 43.80 0.48
[11,] 11.00 43.45 0.33
[12,] 12.00 39.52 0.32
[13,] 13.00 29.53 0.59
[14,] 14.00 25.76 0.59
[15,] 15.00 14.65 0.93
[16,] 16.00 11.55 0.93
[17,] 17.00 10.44 0.84
[18,] 18.00 9.52 0.66
[19,] 19.00 5.23 0.73
[20,] 20.00 3.97 0.41
> m1=VMA(rtn,q=1) ## Estimation
Number of parameters: 6
initial estimates: 0.8935 0.9465 -0.3709 0.1852 -0.533 0.2658
Par. Lower-bounds: 0.4517 0.4391 -0.6746 -0.079 -0.8818 -0.0376
Par. Upper-bounds: 1.3353 1.4539 -0.0672 0.4493 -0.1843 0.5691
Final Estimates: 0.9202558 0.983817 -0.432162 0.2300905 -0.5977663 0.3121533

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
d5 0.9203 0.2596 3.546 0.000392 ***
d8 0.9838 0.3027 3.251 0.001151 **
-0.4322 0.1448 -2.985 0.002837 **
0.2301 0.1255 1.833 0.066808 .
-0.5978 0.1676 -3.567 0.000361 ***
0.3122 0.1454 2.146 0.031834 *
---
Estimates in matrix form:
Constant term:
Estimates: 0.9202558 0.983817
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] -0.432 0.230
[2,] -0.598 0.312

Residuals cov-matrix:
[,1] [,2]
[1,] 29.64753 32.81585
[2,] 32.81585 39.13148
----
aic= 4.44172
bic= 4.485021
> MTSdiag(m1) ### Model checking
[1] "Covariance matrix:"
d5 d8
d5 29.7 32.9
d8 32.9 39.2
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.963
[2,] 0.963 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. -
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
- -
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. .
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
. .
. .
CCM at lag: 14
. .
- -
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. .
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
. .
CCM at lag: 23
. .
. .
CCM at lag: 24
. .
. .
Hit Enter for p-value plot of individual ccm:
## Plot not shown
Hit Enter to compute MQ-statistics:
## Plot noy shown
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.112 4.000 1.00
[2,] 2.000 9.379 8.000 0.31
[3,] 3.000 11.529 12.000 0.48
[4,] 4.000 16.291 16.000 0.43
[5,] 5.000 16.388 20.000 0.69
[6,] 6.000 18.114 24.000 0.80
[7,] 7.000 18.614 28.000 0.91
[8,] 8.000 23.232 32.000 0.87
[9,] 9.000 27.090 36.000 0.86
[10,] 10.000 27.668 40.000 0.93
[11,] 11.000 31.444 44.000 0.92
[12,] 12.000 43.399 48.000 0.66
[13,] 13.000 45.419 52.000 0.73
[14,] 14.000 57.230 56.000 0.43
[15,] 15.000 59.967 60.000 0.48
[16,] 16.000 61.199 64.000 0.58
[17,] 17.000 62.046 68.000 0.68
[18,] 18.000 66.267 72.000 0.67
[19,] 19.000 67.386 76.000 0.75
[20,] 20.000 70.115 80.000 0.78
[21,] 21.000 75.362 84.000 0.74
[22,] 22.000 79.131 88.000 0.74
[23,] 23.000 81.750 92.000 0.77
[24,] 24.000 90.118 96.000 0.65
Hit Enter to obtain residual plots:
## Plot not shown
> names(m1)
[1] "data" "MAorder" "cnst" "coef" "secoef" "residuals"
[7] "Sigma" "Theta" "mu" "aic" "bic"
> r1=m1$residuals
> mq(r1,adj=4)
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.112 0.000 1.00
[2,] 2.000 9.379 4.000 0.05
[3,] 3.000 11.529 8.000 0.17
[4,] 4.000 16.291 12.000 0.18
[5,] 5.000 16.388 16.000 0.43
[6,] 6.000 18.114 20.000 0.58
[7,] 7.000 18.614 24.000 0.77
[8,] 8.000 23.232 28.000 0.72
[9,] 9.000 27.090 32.000 0.71
[10,] 10.000 27.668 36.000 0.84
[11,] 11.000 31.444 40.000 0.83
[12,] 12.000 43.399 44.000 0.50
[13,] 13.000 45.419 48.000 0.58
[14,] 14.000 57.230 52.000 0.29
[15,] 15.000 59.967 56.000 0.33
[16,] 16.000 61.199 60.000 0.43
[17,] 17.000 62.046 64.000 0.55
[18,] 18.000 66.267 68.000 0.54
[19,] 19.000 67.386 72.000 0.63
[20,] 20.000 70.115 76.000 0.67
[21,] 21.000 75.362 80.000 0.63
[22,] 22.000 79.131 84.000 0.63
[23,] 23.000 81.750 88.000 0.67
[24,] 24.000 90.118 92.000 0.54
>
### Exact likelihood estimation
> m2=VMAe(rtn,q=1)
Number of parameters: 6
initial estimates: 0.8934871 0.9464666 -0.3709323 0.1851818 -0.5330449 0.265767
Par. Lower-bounds: 0.4516521 0.4390577 -0.674617 -0.07897083 -0.8818003
-0.03758916
Par. Upper-bounds: 1.335322 1.453875 -0.06724757 0.4493344 -0.1842896 0.5691232
Final Estimates: 0.9195531 0.9828963 -0.4332456 0.2306415 -0.5991734 0.3129031

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
d5 0.9196 0.2594 3.544 0.000394 ***
d8 0.9829 0.3025 3.249 0.001158 **
-0.4332 0.1447 -2.993 0.002760 **
0.2306 0.1255 1.838 0.066102 .
-0.5992 0.1676 -3.576 0.000349 ***
0.3129 0.1454 2.152 0.031423 *
---
Estimates in matrix form:
Constant term:
Estimates: 0.9195531 0.9828963
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] -0.433 0.231
[2,] -0.599 0.313

Residuals cov-matrix:
[,1] [,2]
[1,] 29.64754 32.81583
[2,] 32.81583 39.13143
----
aic= 4.44172
bic= 4.422112
> MTSdiag(m2)
[1] "Covariance matrix:"
d5 d8
d5 29.7 32.9
d8 32.9 39.2
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.963
[2,] 0.963 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. -
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
- -
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. .
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
. .
. .
CCM at lag: 14
. .
- -
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. .
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
. .
CCM at lag: 23
. .
. .
CCM at lag: 24
. .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:

Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.117 4.000 1.00
[2,] 2.000 9.380 8.000 0.31
[3,] 3.000 11.528 12.000 0.48
[4,] 4.000 16.292 16.000 0.43
[5,] 5.000 16.388 20.000 0.69
[6,] 6.000 18.115 24.000 0.80
[7,] 7.000 18.614 28.000 0.91
[8,] 8.000 23.231 32.000 0.87
[9,] 9.000 27.089 36.000 0.86
[10,] 10.000 27.668 40.000 0.93
[11,] 11.000 31.443 44.000 0.92
[12,] 12.000 43.399 48.000 0.66
[13,] 13.000 45.416 52.000 0.73
[14,] 14.000 57.226 56.000 0.43
[15,] 15.000 59.963 60.000 0.48
[16,] 16.000 61.195 64.000 0.58
[17,] 17.000 62.041 68.000 0.68
[18,] 18.000 66.262 72.000 0.67
[19,] 19.000 67.381 76.000 0.75
[20,] 20.000 70.109 80.000 0.78
[21,] 21.000 75.358 84.000 0.74
[22,] 22.000 79.132 88.000 0.74
[23,] 23.000 81.751 92.000 0.77
[24,] 24.000 90.115 96.000 0.65
Hit Enter to obtain residual plots:

> r2=m2$residuals
> mq(r2,adj=4)
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.117 0.000 1.00
[2,] 2.000 9.380 4.000 0.05
[3,] 3.000 11.528 8.000 0.17
[4,] 4.000 16.292 12.000 0.18
[5,] 5.000 16.388 16.000 0.43
[6,] 6.000 18.115 20.000 0.58
[7,] 7.000 18.614 24.000 0.77
[8,] 8.000 23.231 28.000 0.72
[9,] 9.000 27.089 32.000 0.71
[10,] 10.000 27.668 36.000 0.84
[11,] 11.000 31.443 40.000 0.83
[12,] 12.000 43.399 44.000 0.50
[13,] 13.000 45.416 48.000 0.58
[14,] 14.000 57.226 52.000 0.29
[15,] 15.000 59.963 56.000 0.33
[16,] 16.000 61.195 60.000 0.43
[17,] 17.000 62.041 64.000 0.55
[18,] 18.000 66.262 68.000 0.54
[19,] 19.000 67.381 72.000 0.63
[20,] 20.000 70.109 76.000 0.67
[21,] 21.000 75.358 80.000 0.63
[22,] 22.000 79.132 84.000 0.63
[23,] 23.000 81.751 88.000 0.67
[24,] 24.000 90.115 92.000 0.54
>
### Analysis of monhtly log returns of IBM and KO stocks
### Sample period: 2001-2011 for 132 observations
### Purpose: to demonstrate the difference between exact and conditional
### likelihood estimation in small sample.
###
> da=read.table("m-ibmko-0111.txt",header=T)
> head(da)
date ibm ko
1 20010131 0.317647 -0.048205
2 20010228 -0.106875 -0.085690
3 20010330 -0.037237 -0.145012
4 20010430 0.197130 0.022808
5 20010531 -0.027792 0.026196
6 20010629 0.010733 -0.046835
> lrtn=log(da[,2:3]+1)*100
> dim(da)
[1] 132 3
> tdx=c(1:132)/12+2001
> colnames(lrtn) <- c("ibm","ko")
> MTSplot(lrtn,tdx)
> ccm(lrtn)
[1] "Covariance matrix:"
ibm ko
ibm 58.70 6.85
ko 6.85 26.45
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.174
[2,] 0.174 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
+ .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. +
CCM at lag: 7
. .
. -
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. .
. .
CCM at lag: 12
. .
. .
Hit Enter for p-value plot of individual ccm:
## Plot not shown
> mq(lrtn,10)
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.00 3.46 4.00 0.48
[2,] 2.00 7.17 8.00 0.52
[3,] 3.00 10.18 12.00 0.60
[4,] 4.00 19.86 16.00 0.23
[5,] 5.00 25.74 20.00 0.17
[6,] 6.00 36.34 24.00 0.05
[7,] 7.00 46.26 28.00 0.02
[8,] 8.00 46.63 32.00 0.05
[9,] 9.00 52.82 36.00 0.03
[10,] 10.00 53.19 40.00 0.08

> yt=diffM(lrtn)
> mm=ccm(yt)
[1] "Covariance matrix:"
ibm ko
ibm 123.7 20.6
ko 20.6 53.9
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.252
[2,] 0.252 1.000
Simplified matrix:
CCM at lag: 1
- -
. -
CCM at lag: 2
. .
. +
CCM at lag: 3
. .
. -
CCM at lag: 4
. .
+ +
CCM at lag: 5
. .
. -
CCM at lag: 6
. .
. +
CCM at lag: 7
. .
. -
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. .
. -
CCM at lag: 12
. .
. +
Hit Enter for p-value plot of individual ccm:

> m1=VMA(lrtn,q=1,include.mean=F)
Number of parameters: 4
initial estimates: 0.0222 0.228 -0.0597 0.0478
Par. Lower-bounds: -0.1563 -0.0229 -0.1862 -0.1298
Par. Upper-bounds: 0.2008 0.4788 0.0668 0.2255
Final Estimates: 0.06672222 0.1921638 -0.0150886 0.01258459

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] 0.06672 0.09223 0.723 0.469
[2,] 0.19216 0.13083 1.469 0.142
[3,] -0.01509 0.05896 -0.256 0.798
[4,] 0.01258 0.07747 0.162 0.871
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.0667 0.1922
[2,] -0.0151 0.0126

Residuals cov-matrix:
[,1] [,2]
[1,] 57.375898 7.024387
[2,] 7.024387 26.326866
----
aic= 7.347609
bic= 7.434967

> m2=VMAe(lrtn,q=1,include.mean=F)
Number of parameters: 4
initial estimates: 0.02221321 0.2279581 -0.05969568 0.04784385
Par. Lower-bounds: -0.1563293 -0.02285303 -0.1861641 -0.1298152
Par. Upper-bounds: 0.2007557 0.4787693 0.0667727 0.2255029
Final Estimates: 0.07438452 0.2136427 -0.01920058 0.009467724

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] 0.074385 0.096034 0.775 0.439
[2,] 0.213643 0.136284 1.568 0.117
[3,] -0.019201 0.059104 -0.325 0.745
[4,] 0.009468 0.076993 0.123 0.902
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.0744 0.21364
[2,] -0.0192 0.00947

Residuals cov-matrix:
[,1] [,2]
[1,] 57.403576 7.022986
[2,] 7.022986 26.324071
----
aic= 7.348012
bic= 7.287406

> m1=VMA(yt,q=1,include.mean=F)
Number of parameters: 4
initial estimates: 0.8615 0.2418 -0.033 0.877
Par. Lower-bounds: 0.6605 -0.0654 -0.1828 0.6481
Par. Upper-bounds: 1.0625 0.549 0.1168 1.106
Final Estimates: 0.7376101 0.1713921 0.05227489 0.9658542

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] 0.737610 0.004060 181.70 <2e-16 ***
[2,] 0.171392 0.015593 10.99 <2e-16 ***
[3,] 0.052275 0.004776 10.95 <2e-16 ***
[4,] 0.965854 0.001376 701.72 <2e-16 ***
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.7376 0.171
[2,] 0.0523 0.966

Residuals cov-matrix:
[,1] [,2]
[1,] 76.140641 6.232205
[2,] 6.232205 26.019814
----
aic= 7.63271
bic= 7.720502

> m2=VMAe(yt,q=1,include.mean=F)
Number of parameters: 4
initial estimates: 0.8614763 0.2417971 -0.03298869 0.8770208
Par. Lower-bounds: 0.660465 -0.06543428 -0.1827875 0.6480641
Par. Upper-bounds: 1.062488 0.5490285 0.1168102 1.105978
Final Estimates: 0.8769162 0.087439 0.02487615 0.9823279

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] 0.876916 0.003838 228.455 <2e-16 ***
[2,] 0.087439 0.075615 1.156 0.248
[3,] 0.024876 0.021512 1.156 0.248
[4,] 0.982328 0.001452 676.615 <2e-16 ***
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.8769 0.0874
[2,] 0.0249 0.9823

Residuals cov-matrix:
[,1] [,2]
[1,] 83.868320 5.793222
[2,] 5.793222 25.887593
----
aic= 7.728502
bic= 7.667433
###
> t1=m1$Theta; t2=m2$Theta
> eigen(t1)
$values
[1] 1.0000000 0.7034643

$vectors
[,1] [,2]
[1,] -0.5468681 -0.9807264
[2,] -0.8372188 0.1953862

> eigen(t2)
$values
[1] 1.0000000 0.8592442

$vectors
[,1] [,2]
[1,] -0.5791400 -0.9801814
[2,] -0.8152281 0.1981020

#### Compute the theoretical covariance and CCM matrices


####
> phi=matrix(c(.816,-1.116,-.623,1.074,-.643,.615,.592,-.133),2,4)
> phi
[,1] [,2] [,3] [,4]
[1,] 0.816 -0.623 -0.643 0.592
[2,] -1.116 1.074 0.615 -0.133
> theta=matrix(c(0,-.801,-1.248,0),2,2)
> sig=matrix(c(4,2,2,5),2,2)
> VARMAcov(Phi=phi,Theta=theta,Sigma=sig,lag=2)
Auto-Covariance matrix of lag: 0
[,1] [,2]
[1,] 15.70537 3.20314
[2,] 3.20314 29.33396
Auto-Covariance matrix of lag: 1
[,1] [,2]
[1,] 10.87468 7.68762
[2,] -5.21755 23.23317
Auto-Covariance matrix of lag: 2
[,1] [,2]
[1,] 3.92198 7.10492
[2,] -8.50700 14.44155
cross correlation matrix of lag: 0
[,1] [,2]
[1,] 1.0000 0.1492
[2,] 0.1492 1.0000
cross correlation matrix of lag: 1
[,1] [,2]
[1,] 0.6924 0.3582
[2,] -0.2431 0.7920
cross correlation matrix of lag: 2
[,1] [,2]
[1,] 0.2497 0.3310
[2,] -0.3963 0.4923
>

### Simulation
> m1=VARMAsim(400,arlags=c(1,2),malags=c(1),phi=phi,theta=theta,sigma=sig)
> names(m1)
[1] "series" "noises"
> zt=m1$series
> m2=Eccm(zt,maxp=5,maxq=6)
p-values table of Extended Cross-correlation Matrices:
Column: MA order
Row : AR order
0 1 2 3 4 5 6
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0026 0.1885
2 0.0000 0.0579 0.5327 0.9294 0.2038 0.9992 0.9629 <== confirm VARMA(2,1)
3 0.0000 0.9160 0.6494 0.9343 0.9442 0.9983 0.9970
4 0.0016 0.9973 0.9777 0.9959 0.9122 0.9991 0.9836
5 0.1691 0.9999 0.9874 0.9715 0.9353 0.9993 0.9973
> names(m2)
[1] "pEccm" "vEccm" "ARcoef"

### U.S. Hog data


> da=read.table("ushog.txt",header=T)
> head(da)
hogsup hogpri cornsup cornpri wages
1 6.28786 6.39192 6.80239 6.85013 6.58203
2 6.25767 6.23245 6.87109 6.73459 6.57786
3 6.24028 6.49678 6.79459 6.81454 6.57368
4 6.27099 6.62141 6.95750 6.64379 6.58479
5 6.33683 6.60530 6.96319 6.57647 6.59578
6 6.38688 6.39359 7.00941 6.45205 6.60665
> m1=Eccm(da,maxp=5,maxq=6)
p-values table of Extended Cross-correlation Matrices:
Column: MA order
Row : AR order
0 1 2 3 4 5 6
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
1 0.0381 0.6726 0.6879 0.9968 0.9976 0.9981 0.7937 <== VARMA(2,0) or VARMA(1,1)
2 0.8430 0.8577 0.9274 0.9996 0.9999 0.9968 0.9867 at the 5% level.
3 0.9774 1.0000 0.9998 1.0000 1.0000 0.9996 0.9873
4 1.0000 0.9987 1.0000 1.0000 1.0000 1.0000 0.9980
5 0.9998 0.9838 1.0000 1.0000 0.9997 1.0000 0.9996
> VARorder(da,maxp=9) ## VAR order
selected order: aic = 9
selected order: bic = 2
selected order: hq = 2
Summary table:
p AIC BIC HQ M(p) p-value
[1,] 0 -22.9442 -22.9442 -22.9442 0.0000 0.0000
[2,] 1 -28.9922 -28.2585 -28.6976 442.7463 0.0000
[3,] 2 -29.7387 -28.2712 -29.1495 83.4064 0.0000
[4,] 3 -29.7394 -27.5381 -28.8556 34.4902 0.0978
[5,] 4 -29.9699 -27.0349 -28.7915 43.2740 0.0131
[6,] 5 -29.8017 -26.1329 -28.3287 20.5329 0.7183
[7,] 6 -29.8870 -25.4845 -28.1195 28.8457 0.2704
[8,] 7 -30.3135 -25.1772 -28.2514 37.8241 0.0481
[9,] 8 -30.7126 -24.8426 -28.3559 31.7788 0.1645
[10,] 9 -30.8315 -24.2277 -28.1802 19.3093 0.7821
>
### Analysis of the growth rates, in percentages, of PCE and DSPI
> da1=read.table("m-pce.txt",header=T)
> da2=read.table("m-dspi.txt",header=T)
> head(da1)
year mon day pce
1 1959 1 1 306.7
2 1959 2 1 310.2
3 1959 3 1 313.3
4 1959 4 1 312.8
5 1959 5 1 316.7
6 1959 6 1 318.8
> head(da2)
year mon day dspi
1 1959 1 1 340.7
2 1959 2 1 342.4
3 1959 3 1 344.8
4 1959 4 1 347.7
5 1959 5 1 350.0
6 1959 6 1 352.2
> x=cbind(da1$pce,da2$dspi)
> x=log(x)
> zt=diffM(x)*100
> colnames(zt) <- c("pceg","dspig")
> tdx=da1[,1]+da1[,2]/12
> dim(da1)
[1] 639 4

> MTSplot(zt,tdx[2:639]) ### 1 less data point due to differencing


> ## See Figure 3.6 for the plots.

### VAR modeling


> VARorder(zt)
selected order: aic = 8
selected order: bic = 3
selected order: hq = 3
Summary table:
p AIC BIC HQ M(p) p-value
[1,] 0 -1.8494 -1.8494 -1.8494 0.0000 0.0000
[2,] 1 -1.9011 -1.8731 -1.8902 39.9049 0.0000
[3,] 2 -1.9306 -1.8747 -1.9089 26.0294 0.0000
[4,] 3 -2.0291 -1.9452 -1.9965 68.5648 0.0000
[5,] 4 -2.0386 -1.9268 -1.9952 13.5685 0.0088
[6,] 5 -2.0485 -1.9087 -1.9942 13.7797 0.0080
[7,] 6 -2.0544 -1.8867 -1.9893 11.2718 0.0237
[8,] 7 -2.0544 -1.8588 -1.9785 7.6679 0.1045
[9,] 8 -2.0546 -1.8310 -1.9678 7.7194 0.1024
[10,] 9 -2.0506 -1.7991 -1.9530 5.1918 0.2682
[11,] 10 -2.0398 -1.7603 -1.9313 1.0229 0.9063
[12,] 11 -2.0430 -1.7355 -1.9236 9.4609 0.0506
[13,] 12 -2.0418 -1.7064 -1.9116 6.8356 0.1448
[14,] 13 -2.0423 -1.6789 -1.9013 7.7812 0.0999
> m1=VAR(zt,3)
Constant term:
Estimates: 0.4003634 0.3960725
Std.Error: 0.04660595 0.05873444
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] -0.153 0.130
[2,] 0.151 -0.194
standard error
[,1] [,2]
[1,] 0.0409 0.0319
[2,] 0.0515 0.0402
AR( 2 )-matrix
[,1] [,2]
[1,] 0.00526 0.126
[2,] 0.19778 -0.124
standard error
[,1] [,2]
[1,] 0.0411 0.0326
[2,] 0.0518 0.0411
AR( 3 )-matrix
[,1] [,2]
[1,] 0.0531 0.128
[2,] 0.3486 -0.100
standard error
[,1] [,2]
[1,] 0.0403 0.0322
[2,] 0.0508 0.0406

Residuals cov-mtx:
[,1] [,2]
[1,] 0.2947970 0.1088635
[2,] 0.1088635 0.4681942

det(SSE) = 0.126171
AIC = -2.0325
BIC = -1.948644
HQ = -1.999946
> m1a=refVAR(m1,thres=1) ## refinement
Constant term:
Estimates: 0.4026613 0.3960725
Std.Error: 0.04297581 0.05873444
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] -0.154 0.131
[2,] 0.151 -0.194
standard error
[,1] [,2]
[1,] 0.0404 0.0315
[2,] 0.0515 0.0402
AR( 2 )-matrix
[,1] [,2]
[1,] 0.000 0.128
[2,] 0.198 -0.124
standard error
[,1] [,2]
[1,] 0.0000 0.0309
[2,] 0.0518 0.0411
AR( 3 )-matrix
[,1] [,2]
[1,] 0.0524 0.129
[2,] 0.3486 -0.100
standard error
[,1] [,2]
[1,] 0.0398 0.0316
[2,] 0.0508 0.0406

Residuals cov-mtx:
[,1] [,2]
[1,] 0.2948047 0.1088635
[2,] 0.1088635 0.4681942

det(SSE) = 0.1261746
AIC = -2.035606
BIC = -1.958738
HQ = -2.005766
> MTSdiag(m1a) ## Model checking
[1] "Covariance matrix:"
pceg dspig
pceg 0.295 0.109
dspig 0.109 0.469
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.293
[2,] 0.293 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. +
. .
CCM at lag: 5
. .
+ .
CCM at lag: 6
+ .
. .
CCM at lag: 7
+ .
. .
CCM at lag: 8
. .
+ .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
+ .
+ .
CCM at lag: 12
. .
+ +
CCM at lag: 13
. .
. .
CCM at lag: 14
. .
. .
CCM at lag: 15
. .
. .
CCM at lag: 16
. +
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
+ .
CCM at lag: 19
. +
. .
CCM at lag: 20
+ .
. .
CCM at lag: 21
. +
. .
CCM at lag: 22
. .
. .
CCM at lag: 23
. .
. .
CCM at lag: 24
. .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:


### See Figure 3.7
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.531 4.000 0.97
[2,] 2.000 1.820 8.000 0.99
[3,] 3.000 2.692 12.000 1.00
[4,] 4.000 10.446 16.000 0.84
[5,] 5.000 18.559 20.000 0.55
[6,] 6.000 30.639 24.000 0.16
[7,] 7.000 38.656 28.000 0.09
[8,] 8.000 45.967 32.000 0.05
[9,] 9.000 49.494 36.000 0.07
[10,] 10.000 51.224 40.000 0.11
[11,] 11.000 64.809 44.000 0.02
[12,] 12.000 77.212 48.000 0.00
[13,] 13.000 82.621 52.000 0.00
[14,] 14.000 84.489 56.000 0.01
[15,] 15.000 85.862 60.000 0.02
[16,] 16.000 95.699 64.000 0.01
[17,] 17.000 101.586 68.000 0.01
[18,] 18.000 108.779 72.000 0.00
[19,] 19.000 117.606 76.000 0.00
[20,] 20.000 128.078 80.000 0.00
[21,] 21.000 135.317 84.000 0.00
[22,] 22.000 139.947 88.000 0.00
[23,] 23.000 142.923 92.000 0.00
[24,] 24.000 149.481 96.000 0.00
Hit Enter to obtain residual plots:

### VARMA modeling


> Eccm(zt,maxp=6,maxq=6)
p-values table of Extended Cross-correlation Matrices:
Column: MA order
Row : AR order
0 1 2 3 4 5 6
0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0120
1 0.0000 0.0005 0.0003 0.0874 0.2523 0.2738 0.7914
2 0.0000 0.0043 0.0054 0.9390 0.4237 0.3402 0.8482
3 0.0000 0.8328 0.9397 0.9965 0.9376 0.9100 0.8193 <== VARMA(3,1) model
4 0.0003 0.9643 0.9797 0.9937 0.9701 0.9810 0.9620
5 0.0150 1.0000 1.0000 1.0000 0.9995 0.9997 0.9851
6 0.1514 1.0000 1.0000 1.0000 1.0000 1.0000 0.9985
> m2=VARMA(zt,p=3,q=1)
Number of parameters: 18
initial estimates: 0.0908 0.071 0.4888 0.1362 0.0877 0.046 0.0273 0.0583 0.5746
0.0348 0.2203 -0.14 0.3018 -0.1259 -0.7026 -0.0142 -0.4672 -0.2666
Par. lower-bounds: -0.0641 -0.1267 0.2097 -0.0642 -0.0075 -0.0377 -0.0553 -0.015
0.2185 -0.2209 0.0989 -0.2469 0.1965 -0.2194 -0.9937 -0.225 -0.8386 -0.5356
Par. upper-bounds: 0.2458 0.2686 0.7679 0.3366 0.1828 0.1297 0.1098 0.1316 0.9307
0.2905 0.3418 -0.0332 0.4071 -0.0324 -0.4115 0.1966 -0.0958 0.0024
Final Estimates: 0.0389626 -0.04084081 0.4278962 0.3154256 0.04943925 0.08769351
-0.02108149 0.07645094 0.5916242 0.2704941 0.185385 -0.1013903 0.238078 -0.1200853
-0.6300374 -0.225007 -0.4866997 -0.5355579

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
pceg 0.03896 0.03205 1.216 0.224040
dspig -0.04084 0.04966 -0.822 0.410867
pceg 0.42790 0.10935 3.913 9.11e-05 ***
dspig 0.31543 0.07351 4.291 1.78e-05 ***
pceg 0.04944 0.05345 0.925 0.354964
dspig 0.08769 0.04430 1.980 0.047742 *
pceg -0.02108 0.04790 -0.440 0.659822
dspig 0.07645 0.04871 1.569 0.116549
pceg 0.59162 0.18637 3.174 0.001502 **
dspig 0.27049 0.14971 1.807 0.070803 .
pceg 0.18538 0.07523 2.464 0.013725 *
dspig -0.10139 0.06650 -1.525 0.127357
pceg 0.23808 0.06986 3.408 0.000654 ***
dspig -0.12009 0.06612 -1.816 0.069356 .
-0.63004 0.10109 -6.232 4.60e-10 ***
-0.22501 0.06601 -3.409 0.000653 ***
-0.48670 0.18201 -2.674 0.007494 **
-0.53556 0.14869 -3.602 0.000316 ***
---
Estimates in matrix form:
Constant term:
Estimates: 0.0389626 -0.04084081
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.428 0.315
[2,] 0.592 0.270
AR( 2 )-matrix
[,1] [,2]
[1,] 0.0494 0.0877
[2,] 0.1854 -0.1014
AR( 3 )-matrix
[,1] [,2]
[1,] -0.0211 0.0765
[2,] 0.2381 -0.1201
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.630 0.225
[2,] 0.487 0.536

Residuals cov-matrix:
[,1] [,2]
[1,] 0.28024791 0.09216369
[2,] 0.09216369 0.44440559
----
aic= -2.097311
bic= -1.971527
> m2a=refVARMA(m2,thres=0.8) ## refine the model
Number of parameters: 17
initial estimates: 0.0908 0.071 0.4888 0.1362 0.0877 0.046 0.0583 0.5746 0.0348
0.2203 -0.14 0.3018 -0.1259 -0.7026 -0.0142 -0.4672 -0.2666
Par. lower-bounds: -0.0641 -0.1267 0.2097 -0.0642 -0.0075 -0.0377 -0.015 0.2185
-0.2209 0.0989 -0.2469 0.1965 -0.2194 -0.9937 -0.225 -0.8386 -0.5356
Par. upper-bounds: 0.2458 0.2686 0.7679 0.3366 0.1828 0.1297 0.1316 0.9307 0.2905
0.3418 -0.0332 0.4071 -0.0324 -0.4115 0.1966 -0.0958 0.0024
Final Estimates: 0.03787988 -0.04062128 0.4371076 0.3030911 0.04388247
0.08469863 0.06871697 0.592058 0.2697686 0.1780951 -0.1008638 0.2475639 -0.1228671
-0.6408764 -0.2132626 -0.4885212 -0.5355579

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
pceg 0.03788 0.03038 1.247 0.212499
dspig -0.04062 0.04972 -0.817 0.413955
pceg 0.43711 0.10343 4.226 2.38e-05 ***
dspig 0.30309 0.06454 4.696 2.65e-06 ***
pceg 0.04388 0.05301 0.828 0.407808
dspig 0.08470 0.04288 1.975 0.048228 *
dspig 0.06872 0.04219 1.629 0.103365
pceg 0.59206 0.18165 3.259 0.001117 **
dspig 0.26977 0.14385 1.875 0.060751 .
pceg 0.17810 0.07636 2.332 0.019679 *
dspig -0.10086 0.06562 -1.537 0.124268
pceg 0.24756 0.06192 3.998 6.39e-05 ***
dspig -0.12287 0.06317 -1.945 0.051768 .
-0.64088 0.09390 -6.825 8.77e-12 ***
-0.21326 0.05739 -3.716 0.000202 ***
-0.48852 0.17635 -2.770 0.005602 **
-0.53556 0.14266 -3.754 0.000174 ***
---
Estimates in matrix form:
Constant term:
Estimates: 0.03787988 -0.04062128
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.437 0.303
[2,] 0.592 0.270
AR( 2 )-matrix
[,1] [,2]
[1,] 0.0439 0.0847
[2,] 0.1781 -0.1009
AR( 3 )-matrix
[,1] [,2]
[1,] 0.000 0.0687
[2,] 0.248 -0.1229
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.641 0.213
[2,] 0.489 0.536

Residuals cov-matrix:
[,1] [,2]
[1,] 0.28024117 0.09227811
[2,] 0.09227811 0.44464525
----
aic= -2.100075
bic= -1.981279
> m2b=refVARMA(m2a,thres=1) ## Further refinement
Number of parameters: 15
initial estimates: 0.0908 0.4888 0.1362 0.046 0.0583 0.5746 0.0348 0.2203 -0.14
0.3018 -0.1259 -0.7026 -0.0142 -0.4672 -0.2666
Par. lower-bounds: -0.0641 0.2097 -0.0642 -0.0377 -0.015 0.2185 -0.2209 0.0989
-0.2469 0.1965 -0.2194 -0.9937 -0.225 -0.8386 -0.5356
Par. upper-bounds: 0.2458 0.7679 0.3366 0.1297 0.1316 0.9307 0.2905 0.3418 -0.0332
0.4071 -0.0324 -0.4115 0.1966 -0.0958 0.0024
Final Estimates: 0.01692972 0.4845342 0.3154711 0.09407139 0.07706001 0.5485442
0.2659915 0.1412039 -0.09406399 0.2530483 -0.116378 -0.6615449 -0.225007 -0.4228364
-0.5355579

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
0.01693 0.01158 1.462 0.143744
pceg 0.48453 0.09151 5.295 1.19e-07 ***
dspig 0.31547 0.05524 5.711 1.12e-08 ***
dspig 0.09407 0.03873 2.429 0.015143 *
dspig 0.07706 0.03753 2.053 0.040048 *
pceg 0.54854 0.14828 3.699 0.000216 ***
dspig 0.26599 0.13219 2.012 0.044195 *
pceg 0.14120 0.06197 2.278 0.022703 *
dspig -0.09406 0.06094 -1.544 0.122667
pceg 0.25305 0.06108 4.143 3.43e-05 ***
dspig -0.11638 0.05955 -1.954 0.050654 .
-0.66154 0.07139 -9.267 < 2e-16 ***
-0.22501 0.04607 -4.883 1.04e-06 ***
-0.42284 0.13842 -3.055 0.002253 **
-0.53556 0.13021 -4.113 3.90e-05 ***
---
Estimates in matrix form:
Constant term:
Estimates: 0.01692972 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.485 0.315
[2,] 0.549 0.266
AR( 2 )-matrix
[,1] [,2]
[1,] 0.000 0.0941
[2,] 0.141 -0.0941
AR( 3 )-matrix
[,1] [,2]
[1,] 0.000 0.0771
[2,] 0.253 -0.1164
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.662 0.225
[2,] 0.423 0.536

Residuals cov-matrix:
[,1] [,2]
[1,] 0.28073730 0.09236968
[2,] 0.09236968 0.44521036
----
aic= -2.103228
bic= -1.998409

> MTSdiag(m2b) ### Model checking


[1] "Covariance matrix:"
pceg dspig
pceg 0.2812 0.0925
dspig 0.0925 0.4459
CCM at lag: 0
[,1] [,2]
[1,] 1.000 0.261
[2,] 0.261 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. .
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
. .
. -
CCM at lag: 14
. .
. .
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. +
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
. .
CCM at lag: 23
. .
. .
CCM at lag: 24
- .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:


## See Figure 3.9
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.00 1.14 4.00 0.89
[2,] 2.00 1.54 8.00 0.99
[3,] 3.00 2.19 12.00 1.00
[4,] 4.00 5.65 16.00 0.99
[5,] 5.00 6.85 20.00 1.00
[6,] 6.00 15.57 24.00 0.90
[7,] 7.00 18.64 28.00 0.91
[8,] 8.00 19.85 32.00 0.95
[9,] 9.00 21.38 36.00 0.97
[10,] 10.00 25.35 40.00 0.97
[11,] 11.00 31.53 44.00 0.92
[12,] 12.00 38.05 48.00 0.85
[13,] 13.00 45.23 52.00 0.74
[14,] 14.00 46.86 56.00 0.80
[15,] 15.00 51.80 60.00 0.77
[16,] 16.00 57.25 64.00 0.71
[17,] 17.00 59.67 68.00 0.75
[18,] 18.00 61.39 72.00 0.81
[19,] 19.00 68.63 76.00 0.71
[20,] 20.00 72.69 80.00 0.71
[21,] 21.00 80.84 84.00 0.58
[22,] 22.00 82.38 88.00 0.65
[23,] 23.00 87.65 92.00 0.61
[24,] 24.00 101.95 96.00 0.32
Hit Enter to obtain residual plots:
### See Figure 3.10
> names(m2b)
[1] "data" "coef" "secoef" "ARorder" "MAorder" "cnst"
[7] "residuals" "Ph0" "Phi" "Theta" "Sigma" "aic"
[13] "bic"
> phi=m2b$Phi; theta=m2b$Theta; sig=m2b$Sigma
> VARMAirf(Phi=phi,Theta=theta,Sigma=sig,orth=F)
Press return to continue
### See Figure 3.11
>
#### Housing starts and mortgage rate
####
> da=read.table("m-hsmort7112.txt",header=T)
> head(da)
year mon hs mort
1 1971 4 1986 7.31
2 1971 5 2049 7.43
3 1971 6 2026 7.53
4 1971 7 2083 7.60
5 1971 8 2158 7.70
6 1971 9 2041 7.69
> zt=da[,3:4]
> colnames(zt) <- c("hs","mort")
> dzt=diffM(zt)
> dim(da)
[1] 492 4
> tdx=da[,1]+da[,2]/12
> dzt[,1]=dzt[,1]/1000 ### Make the scale of the two series similar
> MTSplot(dzt,tdx[2:492])
### See Figure 3.12

> VARorder(dzt)
selected order: aic = 4
selected order: bic = 2
selected order: hq = 4
Summary table:
p AIC BIC HQ M(p) p-value
[1,] 0 -6.7523 -6.7523 -6.7523 0.0000 0.0000
[2,] 1 -7.0547 -7.0205 -7.0412 151.1868 0.0000
[3,] 2 -7.1856 -7.1173 -7.1588 69.5808 0.0000
[4,] 3 -7.2019 -7.0994 -7.1616 15.3277 0.0041
[5,] 4 -7.2172 -7.0805 -7.1635 14.8115 0.0051
[6,] 5 -7.2055 -7.0346 -7.1384 2.1248 0.7128
[7,] 6 -7.1963 -6.9911 -7.1157 3.2756 0.5128
[8,] 7 -7.1916 -6.9523 -7.0976 5.3665 0.2517
[9,] 8 -7.1778 -6.9043 -7.0704 1.1765 0.8819
[10,] 9 -7.1748 -6.8671 -7.0540 6.0870 0.1927
[11,] 10 -7.1703 -6.8284 -7.0360 5.3664 0.2517
[12,] 11 -7.1580 -6.7819 -7.0103 1.8270 0.7675
[13,] 12 -7.1624 -6.7521 -7.0013 9.3464 0.0530
[14,] 13 -7.1698 -6.7253 -6.9952 10.6760 0.0305
> m1=VAR(dzt,4)
Constant term:
Estimates: -0.005978331 -0.003621627
Std.Error: 0.004785403 0.01158046
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] -0.430 -0.0581
[2,] 0.264 0.5786
standard error
[,1] [,2]
[1,] 0.0454 0.0190
[2,] 0.1099 0.0459
AR( 2 )-matrix
[,1] [,2]
[1,] -0.167 -0.0511
[2,] 0.129 -0.3414
standard error
[,1] [,2]
[1,] 0.0488 0.0219
[2,] 0.1181 0.0530
AR( 3 )-matrix
[,1] [,2]
[1,] -0.00723 -0.0297
[2,] -0.03513 0.0773
standard error
[,1] [,2]
[1,] 0.048 0.0218
[2,] 0.116 0.0527
AR( 4 )-matrix
[,1] [,2]
[1,] 0.0719 -0.0515
[2,] 0.0568 0.0731
standard error
[,1] [,2]
[1,] 0.0447 0.0195
[2,] 0.1082 0.0473

Residuals cov-mtx:
[,1] [,2]
[1,] 0.01084923 -0.00280114
[2,] -0.00280114 0.06353508

det(SSE) = 0.0006814605
AIC = -7.226099
BIC = -7.089352
HQ = -7.172398
> m1a=refVAR(m1,thres=1)
Constant term:
Estimates: -0.005936007 0
Std.Error: 0.004772269 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] -0.429 -0.0582
[2,] 0.272 0.5774
standard error
[,1] [,2]
[1,] 0.045 0.0189
[2,] 0.108 0.0457
AR( 2 )-matrix
[,1] [,2]
[1,] -0.164 -0.0511
[2,] 0.146 -0.3400
standard error
[,1] [,2]
[1,] 0.0451 0.0219
[2,] 0.1088 0.0529
AR( 3 )-matrix
[,1] [,2]
[1,] 0 -0.0293
[2,] 0 0.0815
standard error
[,1] [,2]
[1,] 0 0.0216
[2,] 0 0.0521
AR( 4 )-matrix
[,1] [,2]
[1,] 0.0742 -0.051
[2,] 0.0000 0.071
standard error
[,1] [,2]
[1,] 0.0418 0.0192
[2,] 0.0000 0.0459
Residuals cov-mtx:
[,1] [,2]
[1,] 0.010849747 -0.002798639
[2,] -0.002798639 0.063620722

det(SSE) = 0.0006824364
AIC = -7.236888
BIC = -7.125781
HQ = -7.193256
> MTSdiag(m1a)
[1] "Covariance matrix:"
hs mort
hs 0.0109 -0.0028
mort -0.0028 0.0637
CCM at lag: 0
[,1] [,2]
[1,] 1.000 -0.107
[2,] -0.107 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. -
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
+ .
- .
CCM at lag: 14
. .
- .
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. .
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
- .
CCM at lag: 23
. .
+ .
CCM at lag: 24
- .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:


### See Figure 3.13
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.0000 0.0605 4.0000 1.00
[2,] 2.0000 0.3406 8.0000 1.00
[3,] 3.0000 0.9399 12.0000 1.00
[4,] 4.0000 1.5543 16.0000 1.00
[5,] 5.0000 3.3581 20.0000 1.00
[6,] 6.0000 9.2873 24.0000 1.00
[7,] 7.0000 11.9944 28.0000 1.00
[8,] 8.0000 15.1234 32.0000 1.00
[9,] 9.0000 17.5766 36.0000 1.00
[10,] 10.0000 22.8758 40.0000 0.99
[11,] 11.0000 32.9967 44.0000 0.89
[12,] 12.0000 34.9262 48.0000 0.92
[13,] 13.0000 51.4884 52.0000 0.49
[14,] 14.0000 59.9928 56.0000 0.33
[15,] 15.0000 66.1706 60.0000 0.27
[16,] 16.0000 68.1087 64.0000 0.34
[17,] 17.0000 69.7353 68.0000 0.42
[18,] 18.0000 71.5867 72.0000 0.49
[19,] 19.0000 76.1807 76.0000 0.47
[20,] 20.0000 81.4745 80.0000 0.43
[21,] 21.0000 86.0709 84.0000 0.42
[22,] 22.0000 91.9590 88.0000 0.37
[23,] 23.0000 98.1958 92.0000 0.31
[24,] 24.0000 113.0899 96.0000 0.11
Hit Enter to obtain residual plots:

> Eccm(dzt,maxp=6,maxq=6)
p-values table of Extended Cross-correlation Matrices:
Column: MA order
Row : AR order
0 1 2 3 4 5 6
0 0.0000 0.0091 0.1380 0.5371 0.7427 0.7291 0.6922 <=== ARMA(1,1) or VAR(2)
1 0.0000 0.0715 0.5708 0.8020 0.4297 0.4235 0.5915 at the 5% level
2 0.0816 0.2858 0.9936 0.9557 0.9869 0.9099 0.7486 <=== VMA(2), VAARMA(1,2)
3 0.6841 0.9870 0.9993 0.9977 0.9999 0.9971 0.9894 or VARMA(2,1) at 10% level
4 0.9975 0.9999 1.0000 1.0000 0.9999 0.9921 0.9769
5 0.9994 0.9999 1.0000 1.0000 1.0000 0.9983 0.9429
6 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.9995

### VARMA(2,1) model


> m2=VARMA(dzt,p=2,q=1)
Number of parameters: 14
initial estimates: -0.0026 -0.0077 0.1645 8e-04 0.0508 -0.0391 -0.2243 0.3116
-0.0024 -0.2379 -0.6004 -0.0576 0.4837 0.2689
Par. lower-bounds: -0.0123 -0.0311 -0.1687 -0.1026 -0.0942 -0.0998 -1.0284 0.0621
-0.3523 -0.3844 -0.9461 -0.1678 -0.3504 0.0031
Par. upper-bounds: 0.0071 0.0156 0.4977 0.1042 0.1958 0.0216 0.5798 0.5611 0.3475
-0.0914 -0.2548 0.0525 1.3177 0.5347
Final Estimates: -0.001811257 -0.008629579 0.2130507 0.07787635 0.08927522
-0.06514547 -0.5905927 0.3720104 -0.09588298 -0.2843851 -0.6326968 -0.1458121
0.8794442 0.1994502

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
hs -0.001811 0.002645 -0.685 0.493507
mort -0.008630 0.014061 -0.614 0.539408
hs 0.213051 0.156766 1.359 0.174134
mort 0.077876 0.060042 1.297 0.194623
hs 0.089275 0.089678 0.996 0.319490
mort -0.065145 0.031049 -2.098 0.035891 *
hs -0.590593 0.500036 -1.181 0.237563
mort 0.372010 0.117726 3.160 0.001578 **
hs -0.095883 0.202285 -0.474 0.635500
mort -0.284385 0.074072 -3.839 0.000123 ***
-0.632697 0.148744 -4.254 2.1e-05 ***
-0.145812 0.064866 -2.248 0.024583 *
0.879444 0.513716 1.712 0.086910 .
0.199450 0.119917 1.663 0.096266 .
---
Estimates in matrix form:
Constant term:
Estimates: -0.001811257 -0.008629579
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.213 0.0779
[2,] -0.591 0.3720
AR( 2 )-matrix
[,1] [,2]
[1,] 0.0893 -0.0651
[2,] -0.0959 -0.2844
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.633 0.146
[2,] -0.879 -0.199

Residuals cov-matrix:
[,1] [,2]
[1,] 0.010990390 -0.002755257
[2,] -0.002755257 0.063646117
----
aic= -7.219037
bic= -7.099382
> m2a=refVARMA(m2,thres=0.8)
Number of parameters: 11
initial estimates: 0.1645 8e-04 0.0508 -0.0391 -0.2243 0.3116 -0.2379 -0.6004
-0.0576 0.4837 0.2689
Par. lower-bounds: -0.1687 -0.1026 -0.0942 -0.0998 -1.0284 0.0621 -0.3844 -0.9461
-0.1678 -0.3504 0.0031
Par. upper-bounds: 0.4977 0.1042 0.1958 0.0216 0.5798 0.5611 -0.0914 -0.2548
0.0525 1.3177 0.5347
Final Estimates: 0.1864299 0.08485296 0.06871793 -0.07052745 -0.3978054 0.366489
-0.2669752 -0.6025985 -0.152344 0.6920138 0.2039825

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
hs 0.18643 0.15093 1.235 0.2168
mort 0.08485 0.05876 1.444 0.1487
hs 0.06872 0.08154 0.843 0.3994
mort -0.07053 0.02924 -2.412 0.0159 *
hs -0.39781 0.25699 -1.548 0.1216
mort 0.36649 0.11311 3.240 0.0012 **
mort -0.26698 0.06324 -4.222 2.43e-05 ***
-0.60260 0.14207 -4.242 2.22e-05 ***
-0.15234 0.06361 -2.395 0.0166 *
0.69201 0.29340 2.359 0.0183 *
0.20398 0.11562 1.764 0.0777 .
---
Estimates in matrix form:
Constant term:
Estimates: 0 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.186 0.0849
[2,] -0.398 0.3665
AR( 2 )-matrix
[,1] [,2]
[1,] 0.0687 -0.0705
[2,] 0.0000 -0.2670
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.603 0.152
[2,] -0.692 -0.204

Residuals cov-matrix:
[,1] [,2]
[1,] 0.011023924 -0.002729488
[2,] -0.002729488 0.063698278
----
aic= -7.227145
bic= -7.133131
> m2b=refVARMA(m2a,thres=1)
Number of parameters: 10
initial estimates: 0.1645 8e-04 -0.0391 -0.2243 0.3116 -0.2379 -0.6004 -0.0576
0.4837 0.2689
Par. lower-bounds: -0.1687 -0.1026 -0.0998 -1.0284 0.0621 -0.3844 -0.9461 -0.1678
-0.3504 0.0031
Par. upper-bounds: 0.4977 0.1042 0.0216 0.5798 0.5611 -0.0914 -0.2548 0.0525
1.3177 0.5347
Final Estimates: 0.08754952 0.09722303 -0.08503054 -0.3506756 0.3845908 -0.27324
-0.5038605 -0.1641428 0.6484423 0.1849255

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
hs 0.08755 0.11199 0.782 0.434358
mort 0.09722 0.05580 1.742 0.081456 .
mort -0.08503 0.02347 -3.622 0.000292 ***
hs -0.35068 0.25135 -1.395 0.162971
mort 0.38459 0.11066 3.475 0.000510 ***
mort -0.27324 0.06173 -4.426 9.60e-06 ***
-0.50386 0.10163 -4.958 7.13e-07 ***
-0.16414 0.06071 -2.704 0.006861 **
0.64844 0.28888 2.245 0.024790 *
0.18493 0.11378 1.625 0.104107
---
Estimates in matrix form:
Constant term:
Estimates: 0 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.0875 0.0972
[2,] -0.3507 0.3846
AR( 2 )-matrix
[,1] [,2]
[1,] 0 -0.085
[2,] 0 -0.273
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.504 0.164
[2,] -0.648 -0.185

Residuals cov-matrix:
[,1] [,2]
[1,] 0.011037071 -0.002760741
[2,] -0.002760741 0.063726194
----
aic= -7.229817
bic= -7.14435
> m2c=refVARMA(m2b,thres=1)
Number of parameters: 9
initial estimates: 8e-04 -0.0391 -0.2243 0.3116 -0.2379 -0.6004 -0.0576 0.4837
0.2689
Par. lower-bounds: -0.1026 -0.0998 -1.0284 0.0621 -0.3844 -0.9461 -0.1678 -0.3504
0.0031
Par. upper-bounds: 0.1042 0.0216 0.5798 0.5611 -0.0914 -0.2548 0.0525 1.3177
0.5347
Final Estimates: 0.08393644 -0.08551531 -0.2739981 0.396079 -0.2778629
-0.4302512 -0.150039 0.5459651 0.1741259

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
mort 0.08394 0.05219 1.608 0.107790
mort -0.08552 0.02350 -3.639 0.000274 ***
hs -0.27400 0.22236 -1.232 0.217859
mort 0.39608 0.10794 3.669 0.000243 ***
mort -0.27786 0.06063 -4.583 4.58e-06 ***
-0.43025 0.04284 -10.042 < 2e-16 ***
-0.15004 0.05695 -2.634 0.008430 **
0.54597 0.24839 2.198 0.027950 *
0.17413 0.11151 1.562 0.118396
---
Estimates in matrix form:
Constant term:
Estimates: 0 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.000 0.0839
[2,] -0.274 0.3961
AR( 2 )-matrix
[,1] [,2]
[1,] 0 -0.0855
[2,] 0 -0.2779
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.430 0.150
[2,] -0.546 -0.174

Residuals cov-matrix:
[,1] [,2]
[1,] 0.011051912 -0.002784296
[2,] -0.002784296 0.063733777
----
aic= -7.232599
bic= -7.155679
> MTSdiag(m2c)
[1] "Covariance matrix:"
hs mort
hs 0.01104 -0.00281
mort -0.00281 0.06385
CCM at lag: 0
[,1] [,2]
[1,] 1.000 -0.106
[2,] -0.106 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. .
CCM at lag: 5
. -
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. -
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
+ .
. .
CCM at lag: 14
. .
- .
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. .
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
- .
CCM at lag: 23
. .
+ .
CCM at lag: 24
- .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:


### See Figure 3.14
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.187 4.000 1.00
[2,] 2.000 1.859 8.000 0.99
[3,] 3.000 3.166 12.000 0.99
[4,] 4.000 8.635 16.000 0.93
[5,] 5.000 13.390 20.000 0.86
[6,] 6.000 19.444 24.000 0.73
[7,] 7.000 22.477 28.000 0.76
[8,] 8.000 25.791 32.000 0.77
[9,] 9.000 29.338 36.000 0.78
[10,] 10.000 33.539 40.000 0.75
[11,] 11.000 43.132 44.000 0.51
[12,] 12.000 44.615 48.000 0.61
[13,] 13.000 61.869 52.000 0.16
[14,] 14.000 69.963 56.000 0.10
[15,] 15.000 77.590 60.000 0.06
[16,] 16.000 79.937 64.000 0.09
[17,] 17.000 81.425 68.000 0.13
[18,] 18.000 82.458 72.000 0.19
[19,] 19.000 87.768 76.000 0.17
[20,] 20.000 93.547 80.000 0.14
[21,] 21.000 98.797 84.000 0.13
[22,] 22.000 106.143 88.000 0.09
[23,] 23.000 112.996 92.000 0.07
[24,] 24.000 128.642 96.000 0.01
Hit Enter to obtain residual plots:

##### VARMA(1,2) model


> m3=VARMA(dzt,p=1,q=2)
Number of parameters: 14
initial estimates: -0.0011 -0.0065 0.3229 0.1187 0.6526 -0.094 -0.7572 -0.1751
0.0982 -0.1081 -0.3899 0.6751 0.4519 0.0757
Par. lower-bounds: -0.0107 -0.0302 -0.1231 -0.0707 -0.4401 -0.5579 -1.2111 -0.3681
-0.1286 -0.2315 -1.5023 0.2022 -0.1038 -0.2266
Par. upper-bounds: 0.0086 0.0172 0.7688 0.308 1.7453 0.3699 -0.3032 0.0179 0.325
0.0153 0.7224 1.1479 1.0077 0.3779
Final Estimates: -0.0008971098 -0.004587553 0.538537 0.04706256 1.619589
-0.1810957 -0.9978599 -0.1021182 0.255531 -0.06360827 -1.346278 0.7666739 1.00768
0.2094228

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
hs -0.0008971 0.0025052 -0.358 0.720272
mort -0.0045876 0.0231032 -0.199 0.842601
hs 0.5385370 0.2879294 1.870 0.061431 .
mort 0.0470626 0.1708271 0.275 0.782934
hs 1.6195887 0.9723220 1.666 0.095775 .
mort -0.1810957 0.3446584 -0.525 0.599281
-0.9978599 0.2996612 -3.330 0.000869 ***
-0.1021182 0.1680350 -0.608 0.543373
0.2555310 0.2090113 1.223 0.221492
-0.0636083 0.1293915 -0.492 0.623005
-1.3462779 0.9721282 -1.385 0.166090
0.7666739 0.3482783 2.201 0.027713 *
1.0076795 0.5055476 1.993 0.046235 *
0.2094228 0.2296664 0.912 0.361844
---
Estimates in matrix form:
Constant term:
Estimates: -0.0008971098 -0.004587553
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.539 0.0471
[2,] 1.620 -0.1811
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.998 0.102
[2,] 1.346 -0.767
MA( 2 )-matrix
[,1] [,2]
[1,] -0.256 0.0636
[2,] -1.008 -0.2094

Residuals cov-matrix:
[,1] [,2]
[1,] 0.010788543 -0.002998542
[2,] -0.002998542 0.064313169
----
aic= -7.229278
bic= -7.109624
> m3a=refVARMA(m3,thres=0.6)
Number of parameters: 9
initial estimates: 0.3229 0.6526 -0.7572 -0.1751 0.0982 -0.3899 0.6751 0.4519
0.0757
Par. lower-bounds: -0.1231 -0.4401 -1.2111 -0.3681 -0.1286 -1.5023 0.2022 -0.1038
-0.2266
Par. upper-bounds: 0.7688 1.7453 -0.3032 0.0179 0.325 0.7224 1.1479 1.0077 0.3779
Final Estimates: 0.6654154 1.745263 -1.116874 -0.07449096 0.3249626 -1.479643
0.5897354 1.00768 0.1515263

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
hs 0.66542 0.08646 7.696 1.40e-14 ***
hs 1.74526 1.11287 1.568 0.1168
-1.11687 0.09628 -11.600 < 2e-16 ***
-0.07449 0.01325 -5.620 1.91e-08 ***
0.32496 0.05643 5.758 8.49e-09 ***
-1.47964 1.11408 -1.328 0.1841
0.58974 0.04805 12.273 < 2e-16 ***
1.00768 0.53292 1.891 0.0586 .
0.15153 0.09133 1.659 0.0971 .
---
Estimates in matrix form:
Constant term:
Estimates: 0 0
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.665 0
[2,] 1.745 0
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 1.12 0.0745
[2,] 1.48 -0.5897
MA( 2 )-matrix
[,1] [,2]
[1,] -0.325 0.000
[2,] -1.008 -0.152

Residuals cov-matrix:
[,1] [,2]
[1,] 0.010840482 -0.002977037
[2,] -0.002977037 0.064684274
----
aic= -7.238765
bic= -7.161844
> MTSdiag(m3a)
[1] "Covariance matrix:"
hs mort
hs 0.0108 -0.0030
mort -0.0030 0.0648
CCM at lag: 0
[,1] [,2]
[1,] 1.000 -0.113
[2,] -0.113 1.000
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. .
. .
CCM at lag: 3
. .
. .
CCM at lag: 4
. .
. +
CCM at lag: 5
. .
. .
CCM at lag: 6
. .
. .
CCM at lag: 7
. .
. .
CCM at lag: 8
. .
. .
CCM at lag: 9
. .
. .
CCM at lag: 10
. .
. .
CCM at lag: 11
. -
. .
CCM at lag: 12
. .
. .
CCM at lag: 13
+ .
- .
CCM at lag: 14
. .
- .
CCM at lag: 15
. .
. .
CCM at lag: 16
. .
. .
CCM at lag: 17
. .
. .
CCM at lag: 18
. .
. .
CCM at lag: 19
. .
. .
CCM at lag: 20
. .
. .
CCM at lag: 21
. .
. .
CCM at lag: 22
. .
- .
CCM at lag: 23
. .
. .
CCM at lag: 24
- .
. .
Hit Enter for p-value plot of individual ccm:

Hit Enter to compute MQ-statistics:

Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.000 0.727 4.000 0.95
[2,] 2.000 2.824 8.000 0.94
[3,] 3.000 4.736 12.000 0.97
[4,] 4.000 10.825 16.000 0.82
[5,] 5.000 14.654 20.000 0.80
[6,] 6.000 18.343 24.000 0.79
[7,] 7.000 20.799 28.000 0.83
[8,] 8.000 22.982 32.000 0.88
[9,] 9.000 25.017 36.000 0.92
[10,] 10.000 31.103 40.000 0.84
[11,] 11.000 39.082 44.000 0.68
[12,] 12.000 41.029 48.000 0.75
[13,] 13.000 60.132 52.000 0.21
[14,] 14.000 68.383 56.000 0.12
[15,] 15.000 75.501 60.000 0.09
[16,] 16.000 78.950 64.000 0.10
[17,] 17.000 80.500 68.000 0.14
[18,] 18.000 82.370 72.000 0.19
[19,] 19.000 86.390 76.000 0.19
[20,] 20.000 92.708 80.000 0.16
[21,] 21.000 97.772 84.000 0.14
[22,] 22.000 105.247 88.000 0.10
[23,] 23.000 111.269 92.000 0.08
[24,] 24.000 125.116 96.000 0.02
Hit Enter to obtain residual plots:

>
## Selected R commands and output of Chapter 5
## Output is edited to remove unnecessary output.
> require(fUnitRoots)
> da=read.table("q-ungdp-4812.txt",header=T)
> dim(da)
[1] 258 4
> head(da)
year mon unemp gdp
1 1948 1 3.733333 7.507580
2 1948 4 3.666667 7.525802
3 1948 7 3.766667 7.531177
4 1948 10 3.833333 7.532731
5 1949 1 4.666667 7.518716
6 1949 4 5.866667 7.515072
> gdp=da$gdp ### This step is missing in the text
> m1=ar(diff(gdp),method="mle")
> m1$order
[1] 3
> adfTest(gdp,lags=3)
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 3
STATISTIC:
Dickey-Fuller: 5.5707
P VALUE:
0.99

> adfTest(gdp,lags=3,type="c")
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 3
STATISTIC:
Dickey-Fuller: -2.0176
P VALUE:
0.3056

> adfTest(gdp,lags=3,type="ct")
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 3
STATISTIC:
Dickey-Fuller: -1.625
P VALUE:
0.7338
> library(urca) ### Load urca package
> urppTest(gdp) ## Phillips and Perron test
Title:
Phillips-Perron Unit Root Test

Test Results:

Test regression with intercept

Residuals:
Min 1Q Median 3Q Max
-0.037338 -0.004463 0.000372 0.005414 0.030725

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.031192 0.008801 3.544 0.000468 ***
y.l1 0.997289 0.001018 979.834 < 2e-16 ***
---
Value of test-statistic, type: Z-alpha is: -0.7218

aux. Z statistics
Z-tau-mu 2.7627
## Plots of the output are not shown here.
>
### Multivariate exponential smoothing
> da=read.table("d-sp500-0412.txt",header=T)
> head(da)
mon day year Open High Low Close volume adjClose
1 1 5 2004 1108.48 1122.22 1108.48 1122.22 1578200000 1122.22
2 1 6 2004 1122.22 1124.46 1118.44 1123.67 1494500000 1123.67
3 1 7 2004 1123.67 1126.33 1116.45 1126.33 1704900000 1126.33
4 1 8 2004 1126.33 1131.92 1124.91 1131.92 1868400000 1131.92
5 1 9 2004 1131.92 1131.92 1120.90 1121.86 1720700000 1121.86
6 1 12 2004 1121.86 1127.85 1120.90 1127.23 1510200000 1127.23
> da1=read.table("d-vix-0412.txt",header=T)
> head(da1)
Mon day year VIXOpen VIXHigh VIXLow VIXClose
1 1 5 2004 18.45 18.49 17.44 17.49
2 1 6 2004 17.66 17.67 16.19 16.73
3 1 7 2004 16.72 16.75 15.50 15.50
4 1 8 2004 15.42 15.68 15.32 15.61
5 1 9 2004 16.15 16.88 15.57 16.75
6 1 12 2004 17.32 17.46 16.79 16.82
> sp5=da$adjClose
> vix=da1$VIXClose
> zt=cbind(sp5,vix)
> dim(zt)
[1] 2177 2
> tdx=(4+c(1:2177))/252+2004
> colnames(zt) <- c("S&P 500","VIX")
> require(MTS)
> MTSplot(zt,tdx) ### See Figure 5.2 of the text
> dzt=diffM(zt)
> m2=VMA(dzt,1,include.mean=F)
Number of parameters: 4
initial estimates: 0.029 -0.9175 0.0066 0.2341
Par. Lower-bounds: -0.0495 -1.5299 -0.0036 0.1546
Par. Upper-bounds: 0.1076 -0.3051 0.0168 0.3136
Final Estimates: 0.03940442 -0.8873514 0.004318878 0.2235565

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] 0.039404 0.037577 1.049 0.29434
[2,] -0.887351 0.295456 -3.003 0.00267 **
[3,] 0.004319 0.004935 0.875 0.38149
[4,] 0.223556 0.040372 5.537 3.07e-08 ***
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.03940 -0.887
[2,] 0.00432 0.224

Residuals cov-matrix:
[,1] [,2]
[1,] 217.04782 -23.426840
[2,] -23.42684 3.671484
----
aic= 5.517391
bic= 5.527842
> m2a=refVMA(m2,thres=1)
Number of parameters: 3
initial estimates: 0.029 -0.9175 0.2341
Par. Lower-bounds: -0.0495 -1.5299 0.1546
Par. Upper-bounds: 0.1076 -0.3051 0.3136
Final Estimates: 0.0663969 -0.7171865 0.1949858

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
0.06640 0.02135 3.110 0.00187 **
-0.71719 0.22240 -3.225 0.00126 **
VIX 0.19499 0.02384 8.177 2.22e-16 ***
---
Estimates in matrix form:
MA coefficient matrix
MA( 1 )-matrix
[,1] [,2]
[1,] 0.0664 -0.717
[2,] 0.0000 0.195

Residuals cov-matrix:
[,1] [,2]
[1,] 217.10204 -23.435239
[2,] -23.43524 3.672782
----
aic= 5.516823
bic= 5.524662
>
> MTSdiag(m2a)
[1] "Covariance matrix:"
S&P 500 VIX
S&P 500 217.2 -23.45
VIX -23.4 3.67
CCM at lag: 0
[,1] [,2]
[1,] 1.00 -0.83
[2,] -0.83 1.00
Simplified matrix:
CCM at lag: 1
. .
. .
CCM at lag: 2
. +
+ -
CCM at lag: 3
. .
. -
### See Figure 5.3 for residual CCM.

### Co-integration test


> da=read.table("m-bnd.txt")
> head(da)
V1 V2 V3 V4 V5
1 1954 7 1 2.89 3.50
2 1954 8 1 2.87 3.49
3 1954 9 1 2.89 3.47
4 1954 10 1 2.87 3.46
5 1954 11 1 2.89 3.45
6 1954 12 1 2.90 3.45
> tail(da)
V1 V2 V3 V4 V5
604 2004 10 1 5.47 6.21
605 2004 11 1 5.52 6.20
606 2004 12 1 5.47 6.15
607 2005 1 1 5.36 6.02
608 2005 2 1 5.20 5.82
609 2005 3 1 5.40 6.06
> bnd=da[,4:5]
> colnames(bnd) <- c("Aaa","Baa")
> m1=VARorder(bnd)
selected order: aic = 11
selected order: bic = 3
selected order: hq = 3
Summary table:
p AIC BIC HQ M(p) p-value
[1,] 0 -0.5697 -0.5697 -0.5697 0.0000 0.0000
[2,] 1 -7.8664 -7.8374 -7.8551 4331.0806 0.0000
[3,] 2 -8.1844 -8.1264 -8.1618 195.5266 0.0000
[4,] 3 -8.2589 -8.1720 -8.2251 51.6109 0.0000
[5,] 4 -8.2552 -8.1393 -8.2101 5.5112 0.2387
[6,] 5 -8.2481 -8.1032 -8.1917 3.5073 0.4768
[7,] 6 -8.2751 -8.1013 -8.2075 23.4161 0.0001
[8,] 7 -8.2803 -8.0775 -8.2014 10.6262 0.0311
[9,] 8 -8.2826 -8.0507 -8.1924 8.9080 0.0634
[10,] 9 -8.2784 -8.0176 -8.1769 5.1613 0.2711
[11,] 10 -8.2775 -7.9877 -8.1648 7.0457 0.1335
[12,] 11 -8.2840 -7.9652 -8.1600 11.2224 0.0242
[13,] 12 -8.2812 -7.9334 -8.1459 5.8956 0.2071
[14,] 13 -8.2716 -7.8949 -8.1251 2.0355 0.7292
> pacf(bnd[,1])
> pacf(bnd[,2])
> adfTest(bnd[,1],lags=3,type="c")
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 3
STATISTIC:
Dickey-Fuller: -1.7007
P VALUE:
0.425

> adfTest(bnd[,2],lags=2,type="c")
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 2
STATISTIC:
Dickey-Fuller: -1.6221
P VALUE:
0.4544

> m2=ca.jo(bnd,K=2,ecdet=c("none"))
> summary(m2)

######################
# Johansen-Procedure #
######################

Test type: maximal eigenvalue statistic (lambda max) , with linear trend

Eigenvalues (lambda):
[1] 0.054773196 0.004665298

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 1 | 2.84 6.50 8.18 11.65
r = 0 | 34.19 12.91 14.90 19.19

Eigenvectors, normalised to first column:


(These are the cointegration relations)

Aaa.l2 Baa.l2
Aaa.l2 1.0000000 1.000000
Baa.l2 -0.8856789 -2.723912
Weights W:
(This is the loading matrix)

Aaa.l2 Baa.l2
Aaa.d -0.04696894 0.002477064
Baa.d 0.04046524 0.002139536

> m3=ca.jo(bnd,K=2,ecdet=c("none"),spec=c("transitory"))
> summary(m3)

######################
# Johansen-Procedure #
######################

Test type: maximal eigenvalue statistic (lambda max) , with linear trend

Eigenvalues (lambda):
[1] 0.054773196 0.004665298

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 1 | 2.84 6.50 8.18 11.65
r = 0 | 34.19 12.91 14.90 19.19

Eigenvectors, normalised to first column:


(These are the cointegration relations)

Aaa.l1 Baa.l1
Aaa.l1 1.0000000 1.000000
Baa.l1 -0.8856789 -2.723912

Weights W:
(This is the loading matrix)

Aaa.l1 Baa.l1
Aaa.d -0.04696894 0.002477064
Baa.d 0.04046524 0.002139536

> m4=ca.jo(bnd,K=2,ecdet=c("none"),type=c("trace"),spec=c("transitory"))
> summary(m4)

######################
# Johansen-Procedure #
######################

Test type: trace statistic , with linear trend

Eigenvalues (lambda):
[1] 0.054773196 0.004665298

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 1 | 2.84 6.50 8.18 11.65
r = 0 | 37.03 15.66 17.95 23.52

Eigenvectors, normalised to first column:


(These are the cointegration relations)
Aaa.l1 Baa.l1
Aaa.l1 1.0000000 1.000000
Baa.l1 -0.8856789 -2.723912

Weights W:
(This is the loading matrix)

Aaa.l1 Baa.l1
Aaa.d -0.04696894 0.002477064
Baa.d 0.04046524 0.002139536

> wt=bnd[,1]-0.886*bnd[,2]
> adfTest(wt,lags=3,type="c")

Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 3
STATISTIC:
Dickey-Fuller: -4.6054
P VALUE:
0.01
############### Estimation of ECM model
> m1=ECMvar1(bnd,3,wt) ## Given the co-integrated vector
alpha:
Aaa Baa
[1,] -0.000976 0.0636
standard error
[,1] [,2]
[1,] 0.0347 0.0306
AR coefficient matrix
AR( 1 )-matrix
Aaa Baa
Aaa 0.452 -0.00144
Baa 0.293 0.20386
standard error
[,1] [,2]
[1,] 0.0879 0.1008
[2,] 0.0774 0.0887
AR( 2 )-matrix
Aaa Baa
Aaa -0.300 0.0536
Baa -0.151 0.0275
standard error
[,1] [,2]
[1,] 0.0860 0.0940
[2,] 0.0757 0.0827
-----
Residuals cov-mtx:
Aaa Baa
Aaa 0.04008513 0.03167097
Baa 0.03167097 0.03105743

det(sse) = 0.0002418906
AIC = -8.294184
BIC = -8.221741
> m2=refECMvar1(m1) ####### Refine the model fit
Equation: 1 npar = 2
Equation: 2 npar = 4
alpha:
[,1] [,2]
[1,] 0 0.0627
standard error
[,1] [,2]
[1,] 1 0.0304
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.448 0.000
[2,] 0.286 0.212
standard error
[,1] [,2]
[1,] 0.0393 1.0000
[2,] 0.0746 0.0855
AR( 2 )-matrix
[,1] [,2]
[1,] -0.256 0
[2,] -0.129 0
standard error
[,1] [,2]
[1,] 0.0393 1
[2,] 0.0382 1
-----
Residuals cov-mtx:
[,1] [,2]
[1,] 0.04010853 0.03168199
[2,] 0.03168199 0.03106309

det(sse) = 0.0002421466
AIC = -8.306263
BIC = -8.262797
> beta=c(1,-0.886) ### Initial value of co-integration
> m3=ECMvar(bnd,3,beta,include.const=F) #### Joint estimation
Order p: 3 Co-integrating rank: 1
Number of parameters: 11
initial estimates: -0.0009756982 0.06361006 -0.886 0.4518931 -0.001440502
-0.300017 0.05355619 0.2929306 0.2038601 -0.1508724 0.02750187
Par. Lower-bounds: -0.05305544 0.01776844 -0.9467831 0.3200362 -0.1526555
-0.4290238 -0.08739684 0.1768675 0.07075767 -0.2644268 -0.09656778
Par. Upper-bounds: 0.05110404 0.1094517 -0.8252169 0.5837499 0.1497745 -0.1710102
0.1945092 0.4089936 0.3369625 -0.03731809 0.1515715
Final Estimates: -0.0007856056 0.06377945 -0.8865275 0.4518208 -0.001407315
-0.3000955 0.05359345 0.2928489 0.203919 -0.1509725 0.02759802

Coefficient(s):
Estimate Std. Error t value Pr(>|t|)
[1,] -0.0007856 0.0354493 -0.022 0.982319
[2,] 0.0637794 0.0310768 2.052 0.040139 *
[3,] -0.8865275 0.0055002 -161.181 < 2e-16 ***
[4,] 0.4518208 0.0895744 5.044 4.56e-07 ***
[5,] -0.0014073 0.1025758 -0.014 0.989054
[6,] -0.3000955 0.0860253 -3.488 0.000486 ***
[7,] 0.0535935 0.0939494 0.570 0.568372
[8,] 0.2928489 0.0785638 3.728 0.000193 ***
[9,] 0.2039190 0.0899939 2.266 0.023456 *
[10,] -0.1509725 0.0757242 -1.994 0.046183 *
[11,] 0.0275980 0.0827168 0.334 0.738648
---
Alpha
[,1]
[1,] -0.000786
[2,] 0.063779
standard error
[,1]
[1,] 0.0354
[2,] 0.0311
beta:
[,1]
[1,] 1.000
[2,] -0.887
standard error
[,1]
[1,] 1.0000
[2,] 0.0055
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2]
[1,] 0.452 -0.00141
[2,] 0.293 0.20392
standard error
[,1] [,2]
[1,] 0.0896 0.103
[2,] 0.0786 0.090
AR( 2 )-matrix
[,1] [,2]
[1,] -0.300 0.0536
[2,] -0.151 0.0276
standard error
[,1] [,2]
[1,] 0.0860 0.0939
[2,] 0.0757 0.0827
-----
Residuals cov-mtx:
Aaa Baa
Aaa 0.0399535 0.03156630
Baa 0.0315663 0.03095427

det(sse) = 0.0002403005
AIC = -8.297496
BIC = -8.217807
>
#### 4-Macro Example
> da=read.table("q-4macro.txt",header=T)
> head(da)
year mon day rgnp tb3m gs10 m1sk
1 1959 1 1 2725.1 2.773333 3.990000 139.3333
2 1959 4 1 2793.6 3.000000 4.256667 140.5333
3 1959 7 1 2791.5 3.540000 4.503333 141.5333
4 1959 10 1 2802.2 4.230000 4.583333 140.3000
5 1960 1 1 2864.0 3.873333 4.486667 139.9000
6 1960 4 1 2851.1 2.993333 4.260000 139.6000
> tail(da)
year mon day rgnp tb3m gs10 m1sk
209 2011 1 1 13394.3 0.12666670 3.460000 1879.367
210 2011 4 1 13486.1 0.04666667 3.210000 1926.767
211 2011 7 1 13534.7 0.02333333 2.426667 2077.800
212 2011 10 1 13672.9 0.01333333 2.046667 2153.800
213 2012 1 1 13693.8 0.06666667 2.036667 2223.000
214 2012 4 1 13768.7 0.08666667 1.823333 2252.500
> zt=cbind(log(da$rgnp),da$tb3m,log(da$m1sk),da$gs10)
> colnames(zt) <- c("rgnp","tb3m","lnm1","gs10")
> m1=VARorderI(zt)
selected order: aic = 6
selected order: bic = 2
selected order: hq = 2
M statistic and its p-value
Mstat pv
[1,] 3526.49 0.000e+00
[2,] 150.07 0.000e+00
[3,] 47.98 4.776e-05
[4,] 32.28 9.206e-03
[5,] 19.24 2.564e-01
[6,] 55.17 3.335e-06
[7,] 22.17 1.379e-01
[8,] 27.65 3.479e-02
[9,] 22.97 1.147e-01
[10,] 27.71 3.423e-02
[11,] 15.20 5.097e-01
[12,] 18.21 3.118e-01
[13,] 29.04 2.368e-02
Summary table:
p AIC BIC HQ M(p) p-value
[1,] 0 -3.2537 -3.2537 -3.2537 0.000 0.0000e+00
[2,] 1 -21.1418 -20.8893 -21.0398 3526.493 0.0000e+00
[3,] 2 -21.7738 -21.2671 -21.5690 150.067 0.0000e+00
[4,] 3 -21.8766 -21.1141 -21.5684 47.985 4.7760e-05
[5,] 4 -21.8980 -20.8779 -21.4856 32.275 9.2056e-03
[6,] 5 -21.8491 -20.5698 -21.3319 19.240 2.5641e-01
[7,] 6 -22.0060 -20.4656 -21.3831 55.169 3.3352e-06
[8,] 7 -21.9762 -20.1730 -21.2470 22.167 1.3788e-01
[9,] 8 -21.9807 -19.912> m2=ca.jo(zt,K=5,ecdet=c("none"),spec=c("transitory"))
> summary(m2)

######################
# Johansen-Procedure #
######################

Test type: maximal eigenvalue statistic (lambda max) , with linear trend

Eigenvalues (lambda):
[1] 0.16143084 0.05123820 0.03637617 0.01324657

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 3 | 2.79 6.50 8.18 11.65
r <= 2 | 7.74 12.91 14.90 19.19
r <= 1 | 10.99 18.90 21.07 25.75
r = 0 | 36.80 24.78 27.14 32.14

Eigenvectors, normalised to first column:


(These are the cointegration relations)
rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1
rgnp.l1 1.0000000 1.00000000 1.000000000 1.00000000
tb3m.l1 -0.3748031 -0.01185910 -0.008323757 -0.02759626
lnm1.l1 -0.7625720 -0.65535990 -0.444779385 -0.59712786
gs10.l1 0.3975232 0.03405986 0.027687430 -0.02810554

Weights W:
(This is the loading matrix)

rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1


rgnp.d 0.005322782 0.001446915 -0.01092972 1.205108e-05
tb3m.d 0.210791020 -0.241974802 -0.15253600 4.018748e-01
lnm1.d 0.005401757 0.014661452 0.00530876 8.842242e-04
gs10.d -0.369050278 0.181937747 -0.30633725 2.151025e-01
9 -21.1444 27.651 3.4789e-02
[10,] 9 -21.9590 -19.6247 -21.0148 22.965 1.1467e-01
[11,] 10 -21.9689 -19.3665 -20.9162 27.711 3.4229e-02
[12,] 11 -21.9014 -19.0288 -20.7392 15.205 5.0971e-01
[13,] 12 -21.8545 -18.7101 -20.5823 18.209 3.1182e-01
[14,] 13 -21.8828 -18.4644 -20.4995 29.039 2.3677e-02
> require(fUnitRoots)
> require(urca)

> m2=ca.jo(zt,K=5,ecdet=c("const"),spec=c("transitory"))
> summary(m2)

######################
# Johansen-Procedure #
######################

Test type: maximal eigenvalue statistic (lambda max) , without linear trend and
constant in cointegration

Eigenvalues (lambda):
[1] 1.922074e-01 1.356749e-01 4.000707e-02 2.014771e-02 -1.033542e-16

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 3 | 4.25 7.52 9.24 12.97
r <= 2 | 8.53 13.75 15.67 20.20
r <= 1 | 30.47 19.77 22.00 26.81
r = 0 | 44.61 25.56 28.14 33.24

Eigenvectors, normalised to first column:


(These are the cointegration relations)

rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1 constant


rgnp.l1 1.0000000 1.0000000 1.00000000 1.000000000 1.0000000
tb3m.l1 -0.2819887 -0.7797076 -0.01416840 -0.045476665 0.0396296
lnm1.l1 -0.7919986 -0.6729377 -0.53816014 -0.761616376 -0.1692782
gs10.l1 0.3133461 0.7725252 0.03191589 0.005341667 -0.1914556
constant -3.7262634 -5.9350635 -5.60843447 -3.891464213 -6.4644984

Weights W:
(This is the loading matrix)

rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1 constant


rgnp.d 0.008002569 -0.0002847031 -0.01362198 0.001756145 4.375846e-16
tb3m.d -0.210592115 0.1658140836 -0.13085572 0.393788772 -3.865075e-14
lnm1.d 0.008645836 -0.0006180018 0.01654754 0.001680815 -4.072097e-15
gs10.d -0.273660749 -0.0836309344 -0.19194137 0.270885736 2.500791e-14

> m3=ca.jo(zt,K=5,ecdet=c("const"),spec=c("transitory"),type=c("trace"))
> summary(m3)

######################
# Johansen-Procedure #
######################

Test type: trace statistic , without linear trend and constant in cointegration

Eigenvalues (lambda):
[1] 1.922074e-01 1.356749e-01 4.000707e-02 2.014771e-02 -1.033542e-16

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct


r <= 3 | 4.25 7.52 9.24 12.97
r <= 2 | 12.79 17.85 19.96 24.60
r <= 1 | 43.26 32.00 34.91 41.07
r = 0 | 87.87 49.65 53.12 60.16

Eigenvectors, normalised to first column:


(These are the cointegration relations)

rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1 constant


rgnp.l1 1.0000000 1.0000000 1.00000000 1.000000000 1.0000000
tb3m.l1 -0.2819887 -0.7797076 -0.01416840 -0.045476665 0.0396296
lnm1.l1 -0.7919986 -0.6729377 -0.53816014 -0.761616376 -0.1692782
gs10.l1 0.3133461 0.7725252 0.03191589 0.005341667 -0.1914556
constant -3.7262634 -5.9350635 -5.60843447 -3.891464213 -6.4644984

Weights W:
(This is the loading matrix)

rgnp.l1 tb3m.l1 lnm1.l1 gs10.l1 constant


rgnp.d 0.008002569 -0.0002847031 -0.01362198 0.001756145 4.375846e-16
tb3m.d -0.210592115 0.1658140836 -0.13085572 0.393788772 -3.865075e-14
lnm1.d 0.008645836 -0.0006180018 0.01654754 0.001680815 -4.072097e-15
gs10.d -0.273660749 -0.0836309344 -0.19194137 0.270885736 2.500791e-14

> w1t=zt[,1]-0.282*zt[,2]-0.792*zt[,3]+0.313*zt[,4]
> w2t=zt[,1]-0.78*zt[,2]-0.673*zt[,3]+0.773*zt[,4]
> adfTest(w1t,lags=6,type="c")

Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 6
STATISTIC:
Dickey-Fuller: -3.8739
P VALUE:
0.01

> adfTest(w2t,lags=6,type="c")
Title:
Augmented Dickey-Fuller Test

Test Results:
PARAMETER:
Lag Order: 6
STATISTIC:
Dickey-Fuller: -4.3688
P VALUE:
0.01

> wt=cbind(w1t,w2t)
> m3=ECMvar1(zt,6,wt,include.const=T)
alpha:
w1t w2t
rgnp 0.00974 -0.000622
tb3m 0.11632 0.139180
lnm1 0.00809 -0.000992
gs10 0.05296 -0.161531
standard error
[,1] [,2]
[1,] 0.00348 0.00113
[2,] 0.28304 0.09213
[3,] 0.00397 0.00129
[4,] 0.19919 0.06484
constant term:
rgnp tb3m lnm1 gs10
-0.0325 -1.5371 -0.0263 0.5819
standard error
[1] 0.0120 0.9763 0.0137 0.6870
AR coefficient matrix
AR( 1 )-matrix
rgnp tb3m lnm1 gs10
rgnp 0.193 0.00422 -0.0914 -0.00233
tb3m 14.982 0.45321 0.4497 -0.08414
lnm1 -0.069 -0.00208 0.4453 -0.00471
gs10 7.415 0.06947 0.9398 0.13990
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0711 0.00120 0.0600 0.00153
[2,] 5.7750 0.09744 4.8721 0.12405
[3,] 0.0809 0.00137 0.0683 0.00174
[4,] 4.0641 0.06857 3.4286 0.08730
AR( 2 )-matrix
rgnp tb3m lnm1 gs10
rgnp 0.161 -1.43e-03 0.0893 -0.002829
tb3m 10.697 -3.28e-01 5.5161 -0.173910
lnm1 -0.084 6.36e-05 0.2065 0.000356
gs10 0.528 -1.55e-01 6.1943 -0.043986
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0719 0.00124 0.0646 0.00154
[2,] 5.8368 0.10069 5.2466 0.12535
[3,] 0.0818 0.00141 0.0735 0.00176
[4,] 4.1076 0.07086 3.6922 0.08822
AR( 3 )-matrix
rgnp tb3m lnm1 gs10
rgnp -0.1155 0.002579 -0.0996 -0.001288
tb3m -8.3260 0.430954 10.8227 0.186354
lnm1 -0.0145 0.000509 -0.0316 -0.000907
gs10 -5.0442 0.125956 3.7692 0.130665
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0728 0.00120 0.0665 0.00154
[2,] 5.9137 0.09763 5.4038 0.12529
[3,] 0.0829 0.00137 0.0757 0.00176
[4,] 4.1617 0.06870 3.8029 0.08817
AR( 4 )-matrix
rgnp tb3m lnm1 gs10
rgnp 0.0591 -2.58e-04 -0.0257 -0.00208
tb3m -3.5021 -4.15e-02 -19.1561 -0.01933
lnm1 0.0454 -9.14e-05 -0.0215 -0.00364
gs10 0.9602 4.32e-03 -10.6963 -0.08564
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0693 0.00113 0.0741 0.00153
[2,] 5.6300 0.09213 6.0189 0.12418
[3,] 0.0789 0.00129 0.0844 0.00174
[4,] 3.9621 0.06484 4.2357 0.08739
AR( 5 )-matrix
rgnp tb3m lnm1 gs10
rgnp -0.0693 -7.74e-06 -0.0105 -0.00221
tb3m 6.9776 3.49e-01 6.1031 -0.30925
lnm1 0.0901 7.11e-05 0.0987 0.00281
gs10 -4.0396 1.29e-01 7.3253 -0.30182
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0672 0.00108 0.0665 0.00155
[2,] 5.4602 0.08787 5.4045 0.12577
[3,] 0.0765 0.00123 0.0757 0.00176
[4,] 3.8426 0.06184 3.8033 0.08851
-----
Residuals cov-mtx:
rgnp tb3m lnm1 gs10
rgnp 5.349817e-05 0.0010139262 -7.142742e-06 0.0006583782
tb3m 1.013926e-03 0.3529833289 -1.493661e-04 0.1646324845
lnm1 -7.142742e-06 -0.0001493661 6.933185e-05 -0.0001368415
gs10 6.583782e-04 0.1646324845 -1.368415e-04 0.1748132824

det(sse) = 1.188243e-10
AIC = -21.99356
BIC = -20.54651
> MTSdiag(m3) ### Model checking
[1] "Covariance matrix:"
rgnp tb3m lnm1 gs10
rgnp 5.38e-05 0.00102 -7.18e-06 0.000662
tb3m 1.02e-03 0.35468 -1.50e-04 0.165424
lnm1 -7.18e-06 -0.00015 6.97e-05 -0.000137
gs10 6.62e-04 0.16542 -1.37e-04 0.175654
CCM at lag: 0
[,1] [,2] [,3] [,4]
[1,] 1.000 0.2333 -0.1173 0.2153
[2,] 0.233 1.0000 -0.0302 0.6628
[3,] -0.117 -0.0302 1.0000 -0.0393
[4,] 0.215 0.6628 -0.0393 1.0000
Simplified matrix:
CCM at lag: 1
. . . .
. . . .
. . . .
. . . .
CCM at lag: 2
. . . .
. . . .
. . . .
. . . .
CCM at lag: 3
. . . .
. . . .
. . . .
. . . .
CCM at lag: 4
. . . .
. . . .
. . . .
. . . .
CCM at lag: 5
. . . .
. - . .
. . . .
. . . .
CCM at lag: 6
. . . .
. . . .
. . . .
. . . .
CCM at lag: 7
. . . .
. - . -
. . . .
. . . -
CCM at lag: 8
. . . .
- . . .
. . . .
- - . .
CCM at lag: 9
. . . .
. . . .
. . . .
. . . .
CCM at lag: 10
. . . .
+ . . .
. . . .
+ . . .
CCM at lag: 11
. . . .
. . . .
. . + .
. . . .
CCM at lag: 12
. . . .
. . . .
. . . .
. . . .
CCM at lag: 13
. . . .
. . . .
. . . .
. - . .
CCM at lag: 14
. . . .
. . . .
. . . .
. . . .
CCM at lag: 15
. . . .
. . . .
. . . .
. . . .
CCM at lag: 16
. . . .
. . . .
. . . .
. . . .
CCM at lag: 17
. . . .
. . . .
. . . .
. . . .
CCM at lag: 18
. . . .
. . . .
. . . .
. . . .
CCM at lag: 19
. . . .
. . . .
. . . .
. . . .
CCM at lag: 20
. . . .
. . . .
. . . .
. . . .
CCM at lag: 21
. . . .
. . . .
. . . .
. . . .
CCM at lag: 22
. . . .
. . . .
. . . .
. . . .
CCM at lag: 23
. . . .
. . . .
. . . .
. . . .
CCM at lag: 24
. . . .
. . . .
. . . .
+ . . .
Hit Enter for p-value plot of individual ccm:
### Plot not shown
Hit Enter to compute MQ-statistics:
### Plot not shown
Ljung-Box Statistics:
m Q(m) df p-value
[1,] 1.00 2.09 16.00 1.00
[2,] 2.00 7.23 32.00 1.00
[3,] 3.00 9.11 48.00 1.00
[4,] 4.00 15.00 64.00 1.00
[5,] 5.00 25.16 80.00 1.00
[6,] 6.00 35.23 96.00 1.00
[7,] 7.00 52.67 112.00 1.00
[8,] 8.00 80.87 128.00 1.00
[9,] 9.00 97.36 144.00 1.00
[10,] 10.00 119.12 160.00 0.99
[11,] 11.00 141.98 176.00 0.97
[12,] 12.00 154.72 192.00 0.98
[13,] 13.00 171.58 208.00 0.97
[14,] 14.00 183.18 224.00 0.98
[15,] 15.00 204.90 240.00 0.95
[16,] 16.00 215.62 256.00 0.97
[17,] 17.00 241.67 272.00 0.91
[18,] 18.00 257.49 288.00 0.90
[19,] 19.00 268.08 304.00 0.93
[20,] 20.00 277.31 320.00 0.96
[21,] 21.00 288.65 336.00 0.97
[22,] 22.00 298.95 352.00 0.98
[23,] 23.00 306.68 368.00 0.99
[24,] 24.00 318.97 384.00 0.99
Hit Enter to obtain residual plots:
## plot not shown
Hit return for more plots:
## plot not shown
> m4=refECMvar1(m3,thres=0.8)
Equation: 1 npar = 18
Equation: 2 npar = 17
Equation: 3 npar = 12
Equation: 4 npar = 17
alpha:
[,1] [,2]
[1,] 0.00836 0.000
[2,] 0.00000 0.172
[3,] 0.00528 0.000
[4,] 0.00000 -0.150
standard error
[,1] [,2]
[1,] 0.00233 1.0000
[2,] 1.00000 0.0702
[3,] 0.00224 1.0000
[4,] 1.00000 0.0483
constant term:
[1] -0.0301 -1.2372 -0.0196 0.7577
standard error
[1] 0.00976 0.36863 0.00954 0.25755
AR coefficient matrix
AR( 1 )-matrix
[,1] [,2] [,3] [,4]
[1,] 0.196 0.00415 -0.0893 -0.00219
[2,] 14.986 0.39745 0.0000 0.00000
[3,] -0.062 -0.00227 0.4339 -0.00445
[4,] 7.860 0.06760 0.0000 0.13433
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0696 0.00112 0.0598 0.00145
[2,] 5.5469 0.07110 1.0000 1.00000
[3,] 0.0757 0.00117 0.0631 0.00159
[4,] 3.8226 0.06224 1.0000 0.08164
AR( 2 )-matrix
[,1] [,2] [,3] [,4]
[1,] 0.1618 -0.00132 0.0806 -0.00285
[2,] 11.4784 -0.31896 5.9157 -0.17477
[3,] -0.0613 0.00000 0.1972 0.00000
[4,] 0.0000 -0.17806 6.8124 0.00000
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0708 0.00109 0.0632 0.00149
[2,] 5.5507 0.08366 4.8020 0.11529
[3,] 0.0733 1.00000 0.0651 1.00000
[4,] 1.0000 0.04830 3.3461 1.00000
AR( 3 )-matrix
[,1] [,2] [,3] [,4]
[1,] -0.117 0.00253 -0.117 -0.00129
[2,] -8.551 0.39215 12.188 0.20294
[3,] 0.000 0.00000 0.000 0.00000
[4,] -4.593 0.12655 3.954 0.12920
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0709 0.00109 0.0594 0.00151
[2,] 5.7180 0.09125 4.9811 0.12027
[3,] 1.0000 1.00000 1.0000 1.00000
[4,] 3.9978 0.06433 3.6682 0.08402
AR( 4 )-matrix
[,1] [,2] [,3] [,4]
[1,] 0.058 0 0.0 -0.00238
[2,] 0.000 0 -19.0 0.00000
[3,] 0.000 0 0.0 -0.00326
[4,] 0.000 0 -10.6 -0.07955
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0656 1 1.00 0.00128
[2,] 1.0000 1 5.96 1.00000
[3,] 1.0000 1 1.00 0.00133
[4,] 1.0000 1 4.15 0.07382
AR( 5 )-matrix
[,1] [,2] [,3] [,4]
[1,] -0.0664 0.000 0.000 -0.00201
[2,] 6.7894 0.318 5.019 -0.28887
[3,] 0.1131 0.000 0.075 0.00322
[4,] -3.6087 0.128 7.358 -0.30118
standard error
[,1] [,2] [,3] [,4]
[1,] 0.0642 1.0000 1.0000 0.00123
[2,] 5.3672 0.0838 5.1080 0.11650
[3,] 0.0678 1.0000 0.0553 0.00130
[4,] 3.7635 0.0593 3.6650 0.08368
-----
Residuals cov-mtx:
[,1] [,2] [,3] [,4]
[1,] 5.369361e-05 0.0010198162 -7.005740e-06 0.0006598295
[2,] 1.019816e-03 0.3559545871 -1.477354e-04 0.1644674108
[3,] -7.005740e-06 -0.0001477354 6.992031e-05 -0.0001313209
[4,] 6.598295e-04 0.1644674108 -1.313209e-04 0.1753279352

det(sse) = 1.229817e-10
AIC = -22.22086
BIC = -21.21421

You might also like