#### HW#5, June 2, 2017
#### Problem 1 ####
> Kronspec(kdx=c(1,1,2))
Kronecker indices:  1 1 2 
Dimension:  3 
Notation:  
 0: fixed to 0 
 1: fixed to 1 
 2: estimation 
AR coefficient matrices:  
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    1    0    0    2    2    2    0    0    0
[2,]    0    1    0    2    2    2    0    0    0
[3,]    0    0    1    0    0    2    2    2    2
MA coefficient matrices:  
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    1    0    0    2    2    2    0    0    0
[2,]    0    1    0    2    2    2    0    0    0
[3,]    0    0    1    2    2    2    2    2    2
> 
#### Problem 2
> setwd("C:/Users/rst/teaching/mts/sp2017")
> source("C:/Users/rst/HDSA/HTS/ProcMD.R")
> da <- read.csv("C:/Users/rst/HDSA/HTS/current.csv",header=T)
> m1 <- ProcMD(da)
> names(m1)
[1] "data" "dmtx"
> X <- m1$dmtx
> dim(X)
[1] 687 120
> name <- colnames(da)
> name[1]
[1] "sasdate"
> name <- name[-1]
> length(name)
[1] 120
> name
  [1] "RPI"             "W875RX1"         "DPCERA3M086SBEA" "CMRMTSPLx"      
  [5] "RETAILx"         "INDPRO"          "IPFPNSS"         "IPFINAL"        
  [9] "IPCONGD"         "IPDCONGD"        "IPNCONGD"        "IPBUSEQ"        
 [13] "IPMAT"           "IPDMAT"          "IPNMAT"          "IPMANSICS"      
 [17] "IPB51222S"       "IPFUELS"         "CUMFNS"          "CLF16OV"        
 [21] "CE16OV"          "UNRATE"          "UEMPMEAN"        "UEMPLT5"        
 [25] "UEMP5TO14"       "UEMP15OV"        "UEMP15T26"       "UEMP27OV"       
 [29] "CLAIMSx"         "PAYEMS"          "USGOOD"          "CES1021000001"  
 [33] "USCONS"          "MANEMP"          "DMANEMP"         "NDMANEMP"       
 [37] "SRVPRD"          "USTPU"           "USWTRADE"        "USTRADE"        
 [41] "USFIRE"          "USGOVT"          "CES0600000007"   "AWOTMAN"        
 [45] "AWHMAN"          "HOUST"           "HOUSTNE"         "HOUSTMW"        
 [49] "HOUSTS"          "HOUSTW"          "PERMIT"          "PERMITNE"       
 [53] "PERMITMW"        "PERMITS"         "PERMITW"         "AMDMNOx"        
 [57] "AMDMUOx"         "BUSINVx"         "ISRATIOx"        "M1SL"           
 [61] "M2SL"            "M2REAL"          "AMBSL"           "TOTRESNS"       
 [65] "NONBORRES"       "BUSLOANS"        "REALLN"          "NONREVSL"       
 [69] "CONSPI"          "S.P.500"         "S.P..indust"     "S.P.div.yield"  
 [73] "FEDFUNDS"        "CP3Mx"           "TB3MS"           "TB6MS"          
 [77] "GS1"             "GS5"             "GS10"            "AAA"            
 [81] "BAA"             "COMPAPFFx"       "TB3SMFFM"        "TB6SMFFM"       
 [85] "T1YFFM"          "T5YFFM"          "T10YFFM"         "AAAFFM"         
 [89] "BAAFFM"          "EXSZUSx"         "EXJPUSx"         "EXUSUKx"        
 [93] "EXCAUSx"         "WPSFD49207"      "WPSFD49502"      "WPSID61"        
 [97] "WPSID62"         "OILPRICEx"       "PPICMM"          "CPIAUCSL"       
[101] "CPIAPPSL"        "CPITRNSL"        "CPIMEDSL"        "CUSR0000SAC"    
[105] "CUSR0000SAD"     "CUSR0000SAS"     "CPIULFSL"        "CUSR0000SA0L2"  
[109] "CUSR0000SA0L5"   "PCEPI"           "DDURRG3M086SBEA" "DNDGRG3M086SBEA"
[113] "DSERRG3M086SBEA" "CES0600000008"   "CES2000000008"   "CES3000000008"  
[117] "MZMSL"           "DTCOLNVHFNM"     "DTCTHFNM"        "INVEST"         
> require(MTS)
Loading required package: MTS
> dim(X)
[1] 687 120
> 687-36
[1] 651
> y <- X[2:687,6]
> X1 <- X[1:686,]

> m1 <- SWfore(y,X1,650,10)
MSE of out-of-sample forecasts:  2.805348e-05 
> names(m1)
[1] "coef"     "yhat"     "MSE"      "loadings" "DFindex" 
> sqrt(m1$MSE)
[1] 0.005296554
> m2 <- SWfore(y,X1,650,30)
MSE of out-of-sample forecasts:  2.477952e-05 
> sqrt(m2$MSE)
[1] 0.004977903
> m3 <- SWfore(y,X1,650,50)
MSE of out-of-sample forecasts:  4.120186e-05 
> sqrt(m3$MSE)
[1] 0.006418868
> 
### Problem 3
> y <- X[2:687,22]
> m4 <- SWfore(y,X1,650,10)
MSE of out-of-sample forecasts:  0.02042371 
> sqrt(m4$MSE)
[1] 0.1429115
> m5 <- SWfore(y,X1,650,30)
MSE of out-of-sample forecasts:  0.02657126 
> sqrt(m5$MSE)
[1] 0.1630069
> m6 <- SWfore(y,X1,650,50)
MSE of out-of-sample forecasts:  0.0267818 
> sqrt(m6$MSE)
[1] 0.1636515
> 
> y1 <- X[,22]
> pacf(y1)
> n1 <- arima(y1,order=c(2,0,1),seasonal=list(order=c(1,0,1),period=12))
> n1

Call:
arima(x = y1, order = c(2, 0, 1), seasonal = list(order = c(1, 0, 1), period = 12))

Coefficients:
         ar1     ar2      ma1    sar1     sma1  intercept
      0.6960  0.2032  -0.6952  0.5405  -0.7987    -0.0002
s.e.  0.0574  0.0421   0.0478  0.0726   0.0513     0.0084

sigma^2 estimated as 0.02546:  log likelihood = 284.6,  aic = -555.2
> tsdiag(n1,gof=24)

> yf <- y1[652:687]
> n1 <- arima(y1[1:651],order=c(2,0,1),seasonal=list(order=c(1,0,1),period=12),include.mean=F)
> p1 <- predict(n1,36)
> err <- yf-p1$pred
> sqrt(mean(err^2))
[1] 0.1501588
> 

#### Problem 4 ###
> X <- cbind(UNP,IP,PMI,TCU)
> require(MTS)
> MTSplot(X)
> dX <- diffM(X)
> colnames(X)
[1] "UNP" "IP"  "PMI" "TCU"
> zt <- dX[,1:2]; xt <- dX[,3:4]
> VARorder(zt)
selected order: aic =  6 
selected order: bic =  3 
selected order: hq =  5 
Summary table:  
       p     AIC     BIC      HQ     M(p) p-value
 [1,]  0 -4.9852 -4.9852 -4.9852   0.0000  0.0000
 [2,]  1 -5.1900 -5.1607 -5.1786 127.0760  0.0000
 [3,]  2 -5.2502 -5.1915 -5.2273  42.6817  0.0000
 [4,]  3 -5.2857 -5.1976 -5.2514  28.2548  0.0000
 [5,]  4 -5.3059 -5.1885 -5.2602  19.3748  0.0007
 [6,]  5 -5.3209 -5.1741 -5.2637  16.2423  0.0027
 [7,]  6 -5.3209 -5.1448 -5.2523   7.6620  0.1048
 [8,]  7 -5.3167 -5.1112 -5.2367   5.2267  0.2648
 [9,]  8 -5.3113 -5.0765 -5.2199   4.5298  0.3390
[10,]  9 -5.3052 -5.0410 -5.2024   4.1135  0.3909
[11,] 10 -5.2997 -5.0062 -5.1855   4.4571  0.3477
[12,] 11 -5.2921 -4.9693 -5.1665   3.2369  0.5190
[13,] 12 -5.3140 -4.9618 -5.1768  19.7158  0.0006
[14,] 13 -5.3082 -4.9266 -5.1596   4.2164  0.3775
> m1 <- VAR(zt,5)
Constant term: 
Estimates:  0.01966672 0.05670193 
Std.Error:  0.007383392 0.0211047 
AR coefficient matrix 
AR( 1 )-matrix 
       [,1]    [,2]
[1,] -0.062 -0.0854
[2,] -0.506  0.0814
standard error 
      [,1]  [,2]
[1,] 0.043 0.015
[2,] 0.123 0.043
AR( 2 )-matrix 
        [,1]    [,2]
[1,]  0.0631 -0.0378
[2,] -0.2135  0.1062
standard error 
       [,1]   [,2]
[1,] 0.0433 0.0153
[2,] 0.1239 0.0437
AR( 3 )-matrix 
        [,1]    [,2]
[1,]  0.0884 -0.0175
[2,] -0.1540  0.1682
standard error 
       [,1]   [,2]
[1,] 0.0432 0.0153
[2,] 0.1234 0.0437
AR( 4 )-matrix 
       [,1]    [,2]
[1,] 0.0928 -0.0102
[2,] 0.2344  0.1457
standard error 
       [,1]   [,2]
[1,] 0.0429 0.0155
[2,] 0.1227 0.0442
AR( 5 )-matrix 
       [,1]    [,2]
[1,] 0.0687 -0.0154
[2,] 0.3259  0.0124
standard error 
       [,1]   [,2]
[1,] 0.0422 0.0153
[2,] 0.1208 0.0437
  
Residuals cov-mtx: 
            [,1]        [,2]
[1,]  0.02454520 -0.02039505
[2,] -0.02039505  0.20054556
  
det(SSE) =  0.004506472 
AIC =  -5.335463 
BIC =  -5.188709 
HQ  =  -5.27833 
> m1a <- refVAR(m1,thres=1)
Constant term: 
Estimates:  0.01738008 0.05777494 
Std.Error:  0.00710883 0.02074842 
AR coefficient matrix 
AR( 1 )-matrix 
        [,1]    [,2]
[1,] -0.0613 -0.0885
[2,] -0.5061  0.0828
standard error 
       [,1]   [,2]
[1,] 0.0429 0.0148
[2,] 0.1227 0.0427
AR( 2 )-matrix 
        [,1]    [,2]
[1,]  0.0659 -0.0401
[2,] -0.2141  0.1076
standard error 
       [,1]   [,2]
[1,] 0.0432 0.0152
[2,] 0.1238 0.0434
AR( 3 )-matrix 
        [,1]    [,2]
[1,]  0.0982 -0.0182
[2,] -0.1571  0.1687
standard error 
      [,1]   [,2]
[1,] 0.042 0.0153
[2,] 0.123 0.0437
AR( 4 )-matrix 
      [,1]  [,2]
[1,] 0.110 0.000
[2,] 0.227 0.146
standard error 
       [,1]   [,2]
[1,] 0.0402 0.0000
[2,] 0.1195 0.0441
AR( 5 )-matrix 
       [,1] [,2]
[1,] 0.0853    0
[2,] 0.3161    0
standard error 
       [,1] [,2]
[1,] 0.0399    0
[2,] 0.1157    0
  
Residuals cov-mtx: 
            [,1]       [,2]
[1,]  0.02460541 -0.0204294
[2,] -0.02042940  0.2005734
  
det(SSE) =  0.00451783 
AIC =  -5.342962 
BIC =  -5.218222 
HQ  =  -5.2944 
> m1b <- refVAR(m1a,thres=1.2)
Constant term: 
Estimates:  0.01542687 0.05777494 
Std.Error:  0.006918662 0.02074842 
AR coefficient matrix 
AR( 1 )-matrix 
        [,1]    [,2]
[1,] -0.0568 -0.0898
[2,] -0.5061  0.0828
standard error 
       [,1]   [,2]
[1,] 0.0428 0.0147
[2,] 0.1227 0.0427
AR( 2 )-matrix 
        [,1]    [,2]
[1,]  0.0769 -0.0403
[2,] -0.2141  0.1076
standard error 
       [,1]   [,2]
[1,] 0.0422 0.0152
[2,] 0.1238 0.0434
AR( 3 )-matrix 
       [,1]  [,2]
[1,]  0.112 0.000
[2,] -0.157 0.169
standard error 
       [,1]   [,2]
[1,] 0.0403 0.0000
[2,] 0.1228 0.0437
AR( 4 )-matrix 
      [,1]  [,2]
[1,] 0.118 0.000
[2,] 0.227 0.146
standard error 
       [,1]   [,2]
[1,] 0.0396 0.0000
[2,] 0.1195 0.0441
AR( 5 )-matrix 
       [,1] [,2]
[1,] 0.0878    0
[2,] 0.3161    0
standard error 
       [,1] [,2]
[1,] 0.0398    0
[2,] 0.1157    0
  
Residuals cov-mtx: 
            [,1]       [,2]
[1,]  0.02466481 -0.0204294
[2,] -0.02042940  0.2005734
  
det(SSE) =  0.004529745 
AIC =  -5.343667 
BIC =  -5.226265 
HQ  =  -5.297961 
> MTSdiag(m1b,gof=24)
[1] "Covariance matrix:"
        UNP      IP
UNP  0.0247 -0.0205
IP  -0.0205  0.2009
CCM at lag:  0 
      [,1]  [,2]
[1,]  1.00 -0.29
[2,] -0.29  1.00
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.103   4.000     1.00
 [2,]   2.000     0.643   8.000     1.00
 [3,]   3.000     3.161  12.000     0.99
 [4,]   4.000     4.192  16.000     1.00
 [5,]   5.000     4.646  20.000     1.00
 [6,]   6.000    12.877  24.000     0.97
 [7,]   7.000    16.039  28.000     0.97
 [8,]   8.000    22.671  32.000     0.89
 [9,]   9.000    28.502  36.000     0.81
[10,]  10.000    31.339  40.000     0.83
[11,]  11.000    38.214  44.000     0.72
[12,]  12.000    57.672  48.000     0.16
[13,]  13.000    60.359  52.000     0.20
[14,]  14.000    64.459  56.000     0.20
[15,]  15.000    77.452  60.000     0.06
[16,]  16.000    78.128  64.000     0.11
[17,]  17.000    83.000  68.000     0.10
[18,]  18.000    90.558  72.000     0.07
[19,]  19.000   100.377  76.000     0.03
[20,]  20.000   101.698  80.000     0.05
[21,]  21.000   106.778  84.000     0.05
[22,]  22.000   119.222  88.000     0.01
[23,]  23.000   125.628  92.000     0.01
[24,]  24.000   145.757  96.000     0.00
Hit Enter to obtain residual plots: 

> 
> 
> VARXorder(zt,xt,maxp=11,maxm=6)
selected order(p,s): aic =  7 4 
selected order(p,s): bic =  4 4 
selected order(p,s): hq =  5 4 
> ?VARX
> m2 <- VARX(zt,5,xt,4)
constant term:  
est:  0.0118 0.0272 
 se:  0.0075 0.0088 
AR( 1 ) matrix 
       UNP    IP
UNP -0.176 0.048
IP  -0.007 0.168
standard errors 
      [,1]  [,2]
[1,] 0.041 0.035
[2,] 0.048 0.041
AR( 2 ) matrix 
      UNP     IP
UNP 0.008 -0.051
IP  0.026  0.165
standard errors 
      [,1]  [,2]
[1,] 0.040 0.035
[2,] 0.047 0.041
AR( 3 ) matrix 
       UNP     IP
UNP  0.080 -0.039
IP  -0.015  0.195
standard errors 
      [,1]  [,2]
[1,] 0.040 0.034
[2,] 0.047 0.040
AR( 4 ) matrix 
      UNP     IP
UNP 0.127 -0.029
IP  0.023  0.230
standard errors 
      [,1]  [,2]
[1,] 0.040 0.034
[2,] 0.047 0.040
AR( 5 ) matrix 
      UNP     IP
UNP 0.123 -0.039
IP  0.021  0.029
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.046 0.017
Coefficients of exogenous 
lag- 0  coefficient matrix 
       PMI    TCU
UNP -0.010 -0.067
IP  -0.005  0.812
standard errors 
      [,1]  [,2]
[1,] 0.003 0.012
[2,] 0.003 0.015
lag- 1  coefficient matrix 
       PMI    TCU
UNP -0.011 -0.099
IP  -0.003 -0.180
standard errors 
      [,1]  [,2]
[1,] 0.003 0.031
[2,] 0.003 0.037
lag- 2  coefficient matrix 
       PMI    TCU
UNP -0.008  0.027
IP   0.002 -0.124
standard errors 
      [,1]  [,2]
[1,] 0.003 0.032
[2,] 0.004 0.037
lag- 3  coefficient matrix 
      PMI    TCU
UNP 0.005  0.017
IP  0.001 -0.129
standard errors 
      [,1]  [,2]
[1,] 0.003 0.031
[2,] 0.003 0.037
lag- 4  coefficient matrix 
       PMI    TCU
UNP -0.003  0.004
IP   0.002 -0.176
standard errors 
      [,1]  [,2]
[1,] 0.003 0.030
[2,] 0.003 0.036
Residual Covariance Matrix 
        UNP      IP
UNP 0.01966 0.00068
IP  0.00068 0.02696
=========== 
Information criteria:  
AIC:  -7.401912 
BIC:  -7.091729 
> m2a <- refVARX(m2,thres=1.0)
constant term:  
est:  0.0073 0.0283 
 se:  0.007 0.0087 
AR( 1 ) matrix 
       [,1]  [,2]
[1,] -0.182 0.017
[2,]  0.000 0.171
standard errors 
     [,1]  [,2]
[1,] 0.04 0.029
[2,] 1.00 0.041
AR( 2 ) matrix 
     [,1]   [,2]
[1,]    0 -0.031
[2,]    0  0.167
standard errors 
     [,1]  [,2]
[1,]    1 0.014
[2,]    1 0.041
AR( 3 ) matrix 
      [,1]   [,2]
[1,] 0.087 -0.023
[2,] 0.000  0.192
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 1.000 0.040
AR( 4 ) matrix 
      [,1]  [,2]
[1,] 0.142 0.000
[2,] 0.000 0.225
standard errors 
      [,1] [,2]
[1,] 0.038 1.00
[2,] 1.000 0.04
AR( 5 ) matrix 
      [,1]   [,2]
[1,] 0.128 -0.040
[2,] 0.000  0.025
standard errors 
      [,1]  [,2]
[1,] 0.038 0.014
[2,] 1.000 0.015
Coefficients of exogenous 
lag- 0  coefficient matrix 
       [,1]   [,2]
[1,] -0.010 -0.072
[2,] -0.005  0.812
standard errors 
      [,1]  [,2]
[1,] 0.003 0.012
[2,] 0.003 0.013
lag- 1  coefficient matrix 
       [,1]   [,2]
[1,] -0.011 -0.076
[2,]  0.000 -0.183
standard errors 
      [,1]  [,2]
[1,] 0.003 0.027
[2,] 1.000 0.036
lag- 2  coefficient matrix 
       [,1]   [,2]
[1,] -0.007  0.000
[2,]  0.000 -0.126
standard errors 
      [,1]  [,2]
[1,] 0.003 1.000
[2,] 1.000 0.036
lag- 3  coefficient matrix 
      [,1]   [,2]
[1,] 0.006  0.000
[2,] 0.000 -0.124
standard errors 
      [,1]  [,2]
[1,] 0.003 1.000
[2,] 1.000 0.036
lag- 4  coefficient matrix 
     [,1]   [,2]
[1,]    0  0.000
[2,]    0 -0.174
standard errors 
     [,1]  [,2]
[1,]    1 1.000
[2,]    1 0.034
Residual Covariance Matrix 
        UNP      IP
UNP 0.01986 0.00064
IP  0.00064 0.02710
=========== 
Information criteria:  
AIC:  -7.436783 
BIC:  -7.23738 
> MTSdiag(m2a,gof=24)
[1] "Covariance matrix:"
         UNP       IP
UNP 0.019898 0.000642
IP  0.000642 0.027149
CCM at lag:  0 
       [,1]   [,2]
[1,] 1.0000 0.0276
[2,] 0.0276 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:  

Hit Enter to compute MQ-statistics: 

Ljung-Box Statistics:  
          m       Q(m)     df    p-value
 [1,]   1.000     0.862   4.000     0.93
 [2,]   2.000     1.829   8.000     0.99
 [3,]   3.000     3.930  12.000     0.98
 [4,]   4.000     6.322  16.000     0.98
 [5,]   5.000     7.379  20.000     1.00
 [6,]   6.000    14.780  24.000     0.93
 [7,]   7.000    19.426  28.000     0.88
 [8,]   8.000    22.747  32.000     0.89
 [9,]   9.000    32.956  36.000     0.61
[10,]  10.000    33.671  40.000     0.75
[11,]  11.000    35.706  44.000     0.81
[12,]  12.000    47.127  48.000     0.51
[13,]  13.000    49.074  52.000     0.59
[14,]  14.000    52.140  56.000     0.62
[15,]  15.000    56.669  60.000     0.60
[16,]  16.000    59.787  64.000     0.63
[17,]  17.000    62.030  68.000     0.68
[18,]  18.000    67.244  72.000     0.64
[19,]  19.000    70.982  76.000     0.64
[20,]  20.000    75.728  80.000     0.61
[21,]  21.000    80.526  84.000     0.59
[22,]  22.000    91.045  88.000     0.39
[23,]  23.000    98.102  92.000     0.31
[24,]  24.000   117.203  96.000     0.07
Hit Enter to obtain residual plots: 

> 
> m3 <- VARX(Zt,5,Xt,0)
constant term:  
est:  0.0085 0.0541 
 se:  0.0071 0.0089 
AR( 1 ) matrix 
       UNP    IP
UNP -0.180 0.031
IP   0.007 0.362
standard errors 
     [,1]  [,2]
[1,] 0.04 0.030
[2,] 0.05 0.038
AR( 2 ) matrix 
      UNP     IP
UNP 0.002 -0.030
IP  0.080  0.057
standard errors 
     [,1]  [,2]
[1,] 0.04 0.014
[2,] 0.05 0.017
AR( 3 ) matrix 
      UNP     IP
UNP 0.062 -0.022
IP  0.067  0.070
standard errors 
     [,1]  [,2]
[1,] 0.04 0.014
[2,] 0.05 0.017
AR( 4 ) matrix 
      UNP     IP
UNP 0.114 -0.023
IP  0.095  0.057
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.049 0.018
AR( 5 ) matrix 
      UNP     IP
UNP 0.108 -0.043
IP  0.061  0.043
standard errors 
      [,1]  [,2]
[1,] 0.038 0.014
[2,] 0.048 0.018
Coefficients of exogenous 
lag- 0  coefficient matrix 
       pmi    tcu   pmi1   tcu1
UNP -0.011 -0.075 -0.010 -0.087
IP  -0.002  0.810 -0.002 -0.350
standard errors 
      [,1]  [,2]  [,3]  [,4]
[1,] 0.003 0.012 0.003 0.027
[2,] 0.004 0.015 0.004 0.033
Residual Covariance Matrix 
        UNP      IP
UNP 0.02011 0.00020
IP  0.00020 0.03118
=========== 
Information criteria:  
AIC:  -7.27329 
BIC:  -7.051442 
> m3a <- refVARX(m3,thres=1.0)
constant term:  
est:  0.0086 0.0537 
 se:  0.0071 0.0089 
AR( 1 ) matrix 
      [,1]  [,2]
[1,] -0.18 0.031
[2,]  0.00 0.363
standard errors 
     [,1]  [,2]
[1,] 0.04 0.030
[2,] 1.00 0.038
AR( 2 ) matrix 
      [,1]   [,2]
[1,] 0.000 -0.030
[2,] 0.076  0.056
standard errors 
      [,1]  [,2]
[1,] 1.000 0.013
[2,] 0.049 0.017
AR( 3 ) matrix 
      [,1]   [,2]
[1,] 0.061 -0.023
[2,] 0.062  0.071
standard errors 
      [,1]  [,2]
[1,] 0.040 0.014
[2,] 0.049 0.017
AR( 4 ) matrix 
      [,1]   [,2]
[1,] 0.114 -0.023
[2,] 0.091  0.059
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.048 0.018
AR( 5 ) matrix 
      [,1]   [,2]
[1,] 0.108 -0.043
[2,] 0.060  0.045
standard errors 
      [,1]  [,2]
[1,] 0.038 0.014
[2,] 0.047 0.017
Coefficients of exogenous 
lag- 0  coefficient matrix 
       [,1]   [,2]  [,3]   [,4]
[1,] -0.011 -0.075 -0.01 -0.087
[2,]  0.000  0.806  0.00 -0.354
standard errors 
      [,1]  [,2]  [,3]  [,4]
[1,] 0.003 0.012 0.003 0.027
[2,] 1.000 0.014 1.000 0.033
Residual Covariance Matrix 
        UNP      IP
UNP 0.02011 0.00020
IP  0.00020 0.03121
=========== 
Information criteria:  
AIC:  -7.285949 
BIC:  -7.093681 
> 
> m3 <- VARX(Zt,6,Xt,0)
constant term:  
est:  0.0074 0.0527 
 se:  0.0071 0.0089 
AR( 1 ) matrix 
       UNP    IP
UNP -0.193 0.027
IP   0.013 0.360
standard errors 
     [,1]  [,2]
[1,] 0.04 0.031
[2,] 0.05 0.038
AR( 2 ) matrix 
       UNP     IP
UNP -0.017 -0.034
IP   0.086  0.053
standard errors 
     [,1]  [,2]
[1,] 0.04 0.014
[2,] 0.05 0.017
AR( 3 ) matrix 
      UNP     IP
UNP 0.049 -0.021
IP  0.069  0.065
standard errors 
     [,1]  [,2]
[1,] 0.04 0.014
[2,] 0.05 0.017
AR( 4 ) matrix 
      UNP     IP
UNP 0.106 -0.021
IP  0.101  0.057
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.049 0.018
AR( 5 ) matrix 
      UNP     IP
UNP 0.116 -0.035
IP  0.078  0.043
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.048 0.018
AR( 6 ) matrix 
      UNP    IP
UNP 0.114 0.006
IP  0.011 0.032
standard errors 
      [,1]  [,2]
[1,] 0.038 0.014
[2,] 0.048 0.017
Coefficients of exogenous 
lag- 0  coefficient matrix 
       pmi    tcu   pmi1   tcu1
UNP -0.011 -0.074 -0.011 -0.087
IP  -0.002  0.813  0.000 -0.350
standard errors 
      [,1]  [,2]  [,3]  [,4]
[1,] 0.003 0.012 0.003 0.027
[2,] 0.004 0.015 0.004 0.034
Residual Covariance Matrix 
        UNP      IP
UNP 0.01984 0.00025
IP  0.00025 0.03060
=========== 
Information criteria:  
AIC:  -7.292062 
BIC:  -7.040307 
> m3a <- refVARX(m3,thres=1.0)
constant term:  
est:  0.0101 0.0527 
 se:  0.0065 0.0088 
AR( 1 ) matrix 
       [,1] [,2]
[1,] -0.192 0.00
[2,]  0.000 0.36
standard errors 
     [,1]  [,2]
[1,] 0.04 1.000
[2,] 1.00 0.038
AR( 2 ) matrix 
      [,1]   [,2]
[1,] 0.000 -0.031
[2,] 0.085  0.053
standard errors 
      [,1]  [,2]
[1,] 1.000 0.013
[2,] 0.049 0.017
AR( 3 ) matrix 
      [,1]   [,2]
[1,] 0.055 -0.017
[2,] 0.067  0.065
standard errors 
      [,1]  [,2]
[1,] 0.039 0.013
[2,] 0.049 0.017
AR( 4 ) matrix 
      [,1]   [,2]
[1,] 0.107 -0.018
[2,] 0.101  0.058
standard errors 
      [,1]  [,2]
[1,] 0.039 0.014
[2,] 0.048 0.017
AR( 5 ) matrix 
      [,1]   [,2]
[1,] 0.113 -0.033
[2,] 0.077  0.043
standard errors 
      [,1]  [,2]
[1,] 0.038 0.014
[2,] 0.048 0.017
AR( 6 ) matrix 
      [,1]  [,2]
[1,] 0.107 0.000
[2,] 0.000 0.031
standard errors 
      [,1]  [,2]
[1,] 0.036 1.000
[2,] 1.000 0.017
Coefficients of exogenous 
lag- 0  coefficient matrix 
       [,1]   [,2]   [,3]   [,4]
[1,] -0.011 -0.075 -0.011 -0.065
[2,]  0.000  0.810  0.000 -0.353
standard errors 
      [,1]  [,2]  [,3]  [,4]
[1,] 0.003 0.012 0.003 0.012
[2,] 1.000 0.014 1.000 0.033
Residual Covariance Matrix 
        UNP      IP
UNP 0.01988 0.00025
IP  0.00025 0.03062
=========== 
Information criteria:  
AIC:  -7.313026 
BIC:  -7.113102 
> MTSdiag(m3a,gof=24)
[1] "Covariance matrix:"
         UNP       IP
UNP 0.019914 0.000252
IP  0.000252 0.030671
CCM at lag:  0 
       [,1]   [,2]
[1,] 1.0000 0.0102
[2,] 0.0102 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:  

Hit Enter to compute MQ-statistics: 

Ljung-Box Statistics:  
         m       Q(m)     df    p-value
 [1,]   1.00      5.91    4.00     0.21
 [2,]   2.00     13.39    8.00     0.10
 [3,]   3.00     25.19   12.00     0.01
 [4,]   4.00     50.51   16.00     0.00
 [5,]   5.00     54.79   20.00     0.00
 [6,]   6.00     62.19   24.00     0.00
 [7,]   7.00     69.65   28.00     0.00
 [8,]   8.00     74.69   32.00     0.00
 [9,]   9.00     89.17   36.00     0.00
[10,]  10.00     91.06   40.00     0.00
[11,]  11.00     97.14   44.00     0.00
[12,]  12.00    109.25   48.00     0.00
[13,]  13.00    116.48   52.00     0.00
[14,]  14.00    118.23   56.00     0.00
[15,]  15.00    126.85   60.00     0.00
[16,]  16.00    130.73   64.00     0.00
[17,]  17.00    133.29   68.00     0.00
[18,]  18.00    139.73   72.00     0.00
[19,]  19.00    142.53   76.00     0.00
[20,]  20.00    147.75   80.00     0.00
[21,]  21.00    152.14   84.00     0.00
[22,]  22.00    158.81   88.00     0.00
[23,]  23.00    166.45   92.00     0.00
[24,]  24.00    185.07   96.00     0.00
Hit Enter to obtain residual plots: