エンゲル=グレンジャー共和分検定

Equation
y_{t}=y_{t-1}+\varepsilon _{t}, \; \varepsilon _{t}\sim iidN(0,\sigma ^{2})
x_{t}=x_{t-1}+\nu _{t},\;\nu _{t}\sim iidN(0,\sigma ^{2})
y_{t}=\alpha +\beta x_{t}+\mu _{t}\;,t=1,2,\cdots ,T.
\mu _{t}=\rho \mu _{t-1}+\omega _{t}

$latex \left | \rho \right |< 1&s=1$の場合、$latex y_{t},x_{t}&s=1$(共に単位根過程)は共和分関係、$latex \beta$は共和分係数 R
サンプル:東京市場における月次ドル円為替レートと月次日経平均株価終値の共和分検定
nikkeimonthlydollarjpymonthly

> library(tseries)
> library(urca)
> dataset[1]
      nikkei
1   10783.61
2   11041.92
3   11715.39
4   11761.79
5   11236.37
6   11858.87
7   11325.78
8   11081.79
9   10823.57
10  10771.42
11  10899.25
12  11488.76
13  11387.59
14  11740.60
15  11668.95
16  11008.90
17  11276.59
18  11584.01
19  11899.60
20  12413.60
21  13574.30
22  13606.50
23  14872.15
24  16111.43
25  16649.82
26  16205.43
27  17059.66
28  16906.23
29  15467.33
30  15505.18
31  15456.81
32  16140.76
33  16127.58
34  16399.39
35  16274.33
36  17225.83
37  17383.42
38  17604.12
39  17287.65
40  17400.41
41  17875.75
42  18138.36
43  17248.89
44  16569.09
45  16785.69
46  16737.63
47  15680.67
48  15307.78
49  13592.47
50  13603.02
51  12525.54
52  13849.99
53  14338.54
54  13481.38
55  13376.81
56  13072.87
57  11259.86
58   8576.98
59   8512.27
60   8859.56
61   7994.05
62   7568.42
63   8109.53
64   8828.26
65   9522.50
66   9958.44
67  10356.83
68  10492.53
69  10133.23
70  10034.74
71   9345.55
72  10546.44
73  10198.04
74  10126.03
75  11089.94
76  11057.40
77   9768.70
78   9382.64
79   9537.30
80   8824.06
81   9369.35
82   9202.45
83   9937.04
84  10228.92
85  10237.92
86  10624.09
87   9755.10
88   9849.74
89   9693.73
90   9816.09
91   9833.03
92   8955.20
93   8700.29
94   8988.39
95   8434.61
96   8455.35
97   8802.51
98   9723.24
99  10083.56
100  9520.89
101  8542.73
102  9006.78
103  8695.06
104  8839.91
105  8870.16
106  8928.29
107  9446.01
108 10395.18
109 11138.66
110 11559.36
111 12397.91
112 13860.86
113 13774.54
114 13677.32
115 13668.32
116 13388.86
117 14455.80
118 14327.94
119 15661.87
120 16291.31
121 14914.53

> dataset[2]
    dollaryen
1      106.48
2      106.55
3      108.62
4      107.25
5      112.35
6      109.47
7      109.36
8      110.35
9      110.01
10     108.92
11     104.90
12     103.84
13     103.21
14     104.88
15     105.31
16     107.36
17     106.91
18     108.63
19     111.93
20     110.72
21     111.06
22     114.82
23     118.41
24     118.64
25     115.45
26     117.89
27     117.31
28     117.11
29     111.51
30     114.53
31     115.67
32     115.88
33     117.01
34     118.66
35     117.35
36     117.30
37     120.58
38     120.45
39     117.28
40     118.83
41     120.73
42     122.62
43     121.59
44     116.72
45     115.01
46     115.74
47     111.21
48     112.34
49     107.66
50     107.16
51     100.79
52     102.49
53     104.14
54     106.90
55     106.81
56     109.28
57     106.75
58     100.33
59      96.81
60      91.28
61      90.41
62      92.50
63      97.87
64      99.00
65      96.30
66      96.52
67      94.50
68      94.84
69      91.49
70      90.29
71      89.19
72      89.55
73      91.16
74      90.28
75      90.52
76      93.38
77      91.74
78      90.92
79      87.72
80      85.47
81      84.38
82      81.87
83      82.48
84      83.41
85      82.63
86      82.53
87      81.79
88      83.35
89      81.23
90      80.51
91      79.47
92      77.22
93      76.84
94      76.77
95      77.54
96      77.85
97      76.97
98      78.45
99      82.43
100     81.49
101     79.70
102     79.32
103     79.02
104     78.66
105     78.17
106     78.97
107     80.87
108     83.64
109     89.18
110     93.21
111     94.75
112     97.71
113    101.08
114     97.43
115     99.71
116     97.87
117     99.24
118     97.85
119    100.03
120    103.46
121    103.94

> adf.test(dataset$nikkei)

        Augmented Dickey-Fuller Test

data:  dataset$nikkei
Dickey-Fuller = -1.8822, Lag order = 4, p-value = 0.6255
alternative hypothesis: stationary

> adf.test(diff(dataset$nikkei))

        Augmented Dickey-Fuller Test

data:  diff(dataset$nikkei)
Dickey-Fuller = -4.4789, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary

 警告メッセージ: 
In adf.test(diff(dataset$nikkei)) : p-value smaller than printed p-value

> adf.test(dataset$dollaryen)

        Augmented Dickey-Fuller Test

data:  dataset$dollaryen
Dickey-Fuller = -0.9077, Lag order = 4, p-value = 0.9492
alternative hypothesis: stationary

> adf.test(diff(dataset$dollaryen))

        Augmented Dickey-Fuller Test

data:  diff(dataset$dollaryen)
Dickey-Fuller = -4.9621, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary

 警告メッセージ: 
In adf.test(diff(dataset$dollaryen)) : p-value smaller than printed p-value

> co_integ <- ca.po(dataset[1:2],demean="trend")
> summary(co_integ)

######################################## 
# Phillips and Ouliaris Unit Root Test # 
######################################## 

Test of type Pu 
detrending of series with constant and linear trend 


Call:
lm(formula = z[, 1] ~ z[, -1] + trd)

Residuals:
    Min      1Q  Median      3Q     Max 
-3672.5  -696.6   179.5   824.5  2034.3 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -17269.508   1361.340  -12.69   <2e-16 ***
z[, -1]        265.709     11.491   23.12   <2e-16 ***
trd             48.359      4.506   10.73   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1180 on 118 degrees of freedom
Multiple R-squared:  0.8395,    Adjusted R-squared:  0.8368 
F-statistic: 308.6 on 2 and 118 DF,  p-value: < 2.2e-16


Value of test-statistic is: 33.7696 

Critical values of Pu are:
                  10pct    5pct    1pct
critical values 41.2488 48.8439 65.1714

参考文献
久松博之(1997).『単位根の推定と検定』.信山社.177pp.
福地純一郎、伊藤有希(2011).『Rによる計量経済分析』.朝倉書店.186pp.

アプリケーション
R Core Team (2013). R: A language and environment for statistical computing.
R Foundation for Statistical Computing, Vienna, Austria.
URL http://www.R-project.org/.