『経済・ファイナンスデータの計量時系列分析』
の章末問題で「コンピュータを用いて」とあるものをRで解いています。
5.2.
data<-read.table("economicdata.txt",header=T)
data.ts<-ts(data=data[,2:7],start=c(1975, 1), frequency=12)
以下すべてトレンドがあるので「場合3」の筈だが、解答例と異なる
- topix
plot(stl(data.ts[,1], s.window="per"), main="topix")
- exrate
plot(stl(data.ts[,2], s.window="per"), main="exrate")
- indprod(本書ではGDP)
plot(stl(data.ts[,3], s.window="per"), main="indprod(GDP)")
- cpi
plot(stl(data.ts[,4], s.window="per"), main="cpi")
- saunemp(失業率)
plot(stl(data.ts[,5], s.window="per"), main="saunemp")
- intrate(コールレート)
plot(stl(data.ts[,6], s.window="per"), main="intrate")
5.3.
- テキストの値と合わないが、差分を取って帰無仮説が棄却されたので、単位根過程
-- 差分系列で分析を行う
library(tseries)
adf.test(data.ts[,5],alternative="stationary")
Augmented Dickey-Fuller Test
data: data.ts[, 5]
Dickey-Fuller = -1.5663, Lag order = 7, p-value = 0.76
alternative hypothesis: stationary
adf.test(data.ts[,5],alternative="explosive")
Augmented Dickey-Fuller Test
data: data.ts[, 5]
Dickey-Fuller = -1.5663, Lag order = 7, p-value = 0.24
alternative hypothesis: explosive
adf.test(diff(data.ts[,5]),alternative="stationary")
Augmented Dickey-Fuller Test
data: diff(data.ts[, 5])
Dickey-Fuller = -5.3633, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(data.ts[, 5]), alternative = "stationary") :
p-value smaller than printed p-value
adf.test(diff(data.ts[,5]),alternative="explosive")
Augmented Dickey-Fuller Test
data: diff(data.ts[, 5])
Dickey-Fuller = -5.3633, Lag order = 7, p-value = 0.99
alternative hypothesis: explosive
5.5.
- トレンドの有無でalternative=c("stationaly", "explosiv")を指定する必要があるが、以下は"stationaly"で実行
(1)
- topix
adf.test(log(data.ts[,1]))
Augmented Dickey-Fuller Test
data: log(data.ts[, 1])
Dickey-Fuller = -1.2425, Lag order = 7, p-value = 0.8966
alternative hypothesis: stationary
adf.test(log(data.ts[,1]), alternative="explosiv")
Augmented Dickey-Fuller Test
data: log(data.ts[, 1])
Dickey-Fuller = -1.2425, Lag order = 7, p-value = 0.1034
alternative hypothesis: explosive
pp.test(log(data.ts[,1]))
Phillips-Perron Unit Root Test
data: log(data.ts[, 1])
Dickey-Fuller Z(alpha) = -2.6978, Truncation lag parameter = 5, p-value =
0.9476
alternative hypothesis: stationary
- exrate
adf.test(log(data.ts[,2]))
Augmented Dickey-Fuller Test
data: log(data.ts[, 2])
Dickey-Fuller = -1.748, Lag order = 7, p-value = 0.6833
alternative hypothesis: stationary
pp.test(log(data.ts[,2]))
Phillips-Perron Unit Root Test
data: log(data.ts[, 2])
Dickey-Fuller Z(alpha) = -7.2163, Truncation lag parameter = 5, p-value =
0.7062
alternative hypothesis: stationary
- indprod(本書ではGDP)
adf.test(log(data.ts[,3]))
Augmented Dickey-Fuller Test
data: log(data.ts[, 3])
Dickey-Fuller = -2.2418, Lag order = 7, p-value = 0.4749
alternative hypothesis: stationary
pp.test(log(data.ts[,3]))
Phillips-Perron Unit Root Test
data: log(data.ts[, 3])
Dickey-Fuller Z(alpha) = -4.6404, Truncation lag parameter = 5, p-value =
0.8504
alternative hypothesis: stationary
- cpi
adf.test(log(data.ts[,4]))
Augmented Dickey-Fuller Test
data: log(data.ts[, 4])
Dickey-Fuller = -3.8057, Lag order = 7, p-value = 0.01899
alternative hypothesis: stationary
pp.test(log(data.ts[,4]))
Phillips-Perron Unit Root Test
data: log(data.ts[, 4])
Dickey-Fuller Z(alpha) = -4.1101, Truncation lag parameter = 5, p-value =
0.8801
alternative hypothesis: stationary
- saunemp(失業率)
adf.test(data.ts[,5])
Augmented Dickey-Fuller Test
data: data.ts[, 5]
Dickey-Fuller = -1.5663, Lag order = 7, p-value = 0.76
alternative hypothesis: stationary
pp.test(data.ts[,5])
Phillips-Perron Unit Root Test
data: data.ts[, 5]
Dickey-Fuller Z(alpha) = -3.4958, Truncation lag parameter = 5, p-value =
0.9117
alternative hypothesis: stationary
- intrate(コールレート)
adf.test(data.ts[,6])
Augmented Dickey-Fuller Test
data: data.ts[, 6]
Dickey-Fuller = -3.7402, Lag order = 7, p-value = 0.02226
alternative hypothesis: stationary
pp.test(data.ts[,6])
Phillips-Perron Unit Root Test
data: data.ts[, 6]
Dickey-Fuller Z(alpha) = -15.324, Truncation lag parameter = 5, p-value =
0.2523
alternative hypothesis: stationary
- cpi, intrateのadfのみ帰無仮説を棄却
(2)
- topix
adf.test(diff(log(data.ts[,1])))
Augmented Dickey-Fuller Test
data: diff(log(data.ts[, 1]))
Dickey-Fuller = -6.3141, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(log(data.ts[, 1]))) : p-value smaller than printed p-value
pp.test(diff(log(data.ts[,1])))
Phillips-Perron Unit Root Test
data: diff(log(data.ts[, 1]))
Dickey-Fuller Z(alpha) = -253.61, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(log(data.ts[, 1]))) : p-value smaller than printed p-value
- exrate
adf.test(diff(log(data.ts[,2])))
Augmented Dickey-Fuller Test
data: diff(log(data.ts[, 2]))
Dickey-Fuller = -5.8527, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(log(data.ts[, 2]))) : p-value smaller than printed p-value
pp.test(diff(log(data.ts[,2])))
Phillips-Perron Unit Root Test
data: diff(log(data.ts[, 2]))
Dickey-Fuller Z(alpha) = -246.95, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(log(data.ts[, 2]))) : p-value smaller than printed p-value
- indprod(本書ではGDP)
adf.test(diff(log(data.ts[,3])))
Augmented Dickey-Fuller Test
data: diff(log(data.ts[, 3]))
Dickey-Fuller = -5.1424, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(log(data.ts[, 3]))) : p-value smaller than printed p-value
pp.test(diff(log(data.ts[,3])))
Phillips-Perron Unit Root Test
data: diff(log(data.ts[, 3]))
Dickey-Fuller Z(alpha) = -553.4, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(log(data.ts[, 3]))) : p-value smaller than printed p-value
- cpi
adf.test(diff(log(data.ts[,4])))
Augmented Dickey-Fuller Test
data: diff(log(data.ts[, 4]))
Dickey-Fuller = -4.6986, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(log(data.ts[, 4]))) : p-value smaller than printed p-value
pp.test(diff(log(data.ts[,4])))
Phillips-Perron Unit Root Test
data: diff(log(data.ts[, 4]))
Dickey-Fuller Z(alpha) = -267.34, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(log(data.ts[, 4]))) : p-value smaller than printed p-value
- saunemp(失業率)
adf.test(diff(data.ts[,5]))
Augmented Dickey-Fuller Test
data: diff(data.ts[, 5])
Dickey-Fuller = -5.3633, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(data.ts[, 5])) : p-value smaller than printed p-value
pp.test(diff(data.ts[,5]))
Phillips-Perron Unit Root Test
data: diff(data.ts[, 5])
Dickey-Fuller Z(alpha) = -387.91, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(data.ts[, 5])) : p-value smaller than printed p-value
- intrate(コールレート)
adf.test(diff(data.ts[,6]))
Augmented Dickey-Fuller Test
data: diff(data.ts[, 6])
Dickey-Fuller = -5.9193, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(diff(data.ts[, 6])) : p-value smaller than printed p-value
pp.test(diff(data.ts[,6]))
Phillips-Perron Unit Root Test
data: diff(data.ts[, 6])
Dickey-Fuller Z(alpha) = -263.86, Truncation lag parameter = 5, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In pp.test(diff(data.ts[, 6])) : p-value smaller than printed p-value
- すべて、p-value=0.01 となり、5or1%の危険率で帰無仮説が棄却される。