### 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: >