## How jMulti does the Prediction?

Megh
2010-12-13
2013-04-30

• Megh
2010-12-13

Dear all, I am struggling on how jMulti gives the prediction for ordinary VAR/VEC model. Here I am trying to get 2 step ahead forecast for the dataset attached in the following link (please find the link at the bottom "Save file to your PC"):
http://www.2shared.com/document/DFUkQ6rQ/Book1.html

Here I choose a VECM with 2 co-integration relationships with lag-length in differenced equation as 3 and with constant on the co-integration equation & seasonal (monthly) dummy on differenced equation. From this model specification I got 2-step predictions as:

time        forecast     lower CI     upper CI     +/-
2010 M5    -0.5258      -0.6466      -0.4050       0.1208
2010 M6    -0.5347      -0.7185      -0.3510       0.1837

However I did this same calculation manually using R, after copy-pasting the estimated coefficients (in level form) from  jMulti. This is my R code (please just copy-paste following R code in your R console):

**_A1 <- t(matrix(c(-0.9444135,  0.5289205,  1.54338344, -1.2059849,  0.08658383, -0.7626375, 0.5384060,  1.34211012, -0.1540462,  0.07684465,
-1.5000912,  0.5975748,  2.08629175, -1.3629879,  0.16405863,  0.5622497, -0.5749668, -0.01207330,  1.6547463, -0.37280903, -1.1190102,
0.4834678,  1.04152221, -0.5084529,  0.91748918), 5))

A2 <- t(matrix(c(-0.5281084,  0.6750694, -0.00700632,  0.5744008, -0.540538174, -0.5115759,  0.6663074, -0.03690401,  0.1015040,
-0.483984397, -0.6669159,  0.7810531, -0.08478713,  0.2837110, -0.634807434,  0.2474859, -0.2126529,  -0.04611398, -0.2851814, -0.003198122,
0.1136257, -0.4070806, -0.15362813,  0.1043871, -0.570401589), 5))

A3 <- t(matrix(c(-0.4284946,  0.17025876, 0.225043136, -0.43887003, 0.27709232, -0.5688888,  0.42330395, 0.164361177, -0.58429951,
0.21730850, -0.0189839, -0.08814357, 0.123997183,  0.63526538, 0.28093847, -0.0475664,  0.11395484, 0.005934839, -0.03397662, 0.05288304,
-0.6183575,  0.50995964, 0.381706213,  0.64043014, 0.47786143), 5))

A4 <- t(matrix(c(-1.0871150, -0.07412654,  0.98066023, -0.6315551, -0.3708366, -1.0458028, 0.11770720,  0.82359396, -0.3562098, -0.4274062,
-1.0897489, -0.17222605,  1.04791955, -1.0155973, -0.2033966, -0.1128249,  0.26689631, -0.08886136, 0.1801892, -0.1426370, -0.2721915,
-0.22595545,  0.43729292, -0.7302551, -0.3751305), 5))

Mu <- t(matrix(c(0.01971314683, 7.392074e-05, 0.06745512042, 0.03066764063, -0.05716243051, -0.01666261294, -0.02648375478, -0.07739940822,
-0.08537205872, -0.03454705454, 0.01026347102, 3.93408495893, 0.01124435027, 0.00826573416, 0.07232184812, 0.02643898799, -0.02290620244,
0.00631679187, -0.02120713774, -0.06034222549, -0.06737971493, -0.02466344307, 0.01574220616, 3.67816873865, 0.01817359276, 0.00511780538,
0.06717006338, 0.06206760303, -0.04353428003, -0.03033956305, -0.00535023233, -0.06992876937, -0.10020345332, -0.04323120694, 0.00399287988,
3.01849213684,-0.00696500762, 0.00784220761, 0.00337317617, -0.00771413903, 0.03016416594, 0.02404299199, 0.00752992866, 0.01211247641,
0.01442465011, 0.00162618787, 0.00646325736, 0.18377741575,0.06172376263, 0.03093119587, 0.00519357485, -0.00720735363, -0.02268228948,
-0.03428031321, 0.01599783772, -0.01470977952, -0.00498472297, -0.03734476303, -0.03712904004, 2.95905626288), ncol=5))

## YY is the last 4 TS values
YY <- t(matrix(c(-0.55367226, 3.276980, -0.57634682, 3.827854, 4.248918, -0.57806007, 3.254492, -0.61281320, 3.835869, 4.280090, -0.51697066,
3.300236, -0.55756556, 3.815981, 4.274613, -0.47619582, 3.320164, -0.48689008, 3.793915, 4.216955), 5))

## Creating the Dummy variable
Dummy <- matrix(0, 2, 12)
Dummy <- Dummy <- Dummy <- 1; Dummy

## YY1 is 1-step ahead prediction without deterministic term, similarly the YY2
YY1 <- A1%*%YY + A2%*%YY + A3%*%YY + A4%*%YY
YY2 <- A1%*%YY1 +    A2%*%YY + A3%*%YY + A4%*%YY

## 1-step & 2-step ahead forecast eith deterministic term
YY1 <- YY1 + Mu%*%Dummy
YY2 <- YY2 + Mu%*%Dummy

YY1
YY2_**

Using above manual calculation, I get the 1st prediction exactly matched, however there is drastic difference in the 2nd prediction. Can somebody please point me where I am doing wrong? What I am missing?