CLIおよびNFCIおよび指数の季節性

データの準備

> TERM
[1] "1972::2022"

の時、以下の操作で都合の良いデータセットを作る。

merge(g20=diff(cli_g20)[TERM],usa=diff(cli_usa)[TERM],g7=diff(cli_g7)[TERM])-> w
merge(w,nfci=as.vector(diff(to.monthly(NFCI)[,4])[TERM]),spx=as.vector(monthlyReturn(GSPC)[TERM])) -> w

結果は以下の通り

> head(w)
g20 usa g7 nfci spx
1972-01-01 0.3511 0.3964 0.3522 -0.38910 0.018121325
1972-02-01 0.3545 0.3540 0.3532 -0.37591 0.025303040
1972-03-01 0.3428 0.2773 0.3392 -0.19033 0.005911579
1972-04-01 0.3225 0.2043 0.3169 -0.16699 0.004384338
1972-05-01 0.2943 0.1567 0.2876 -0.15576 0.017275017
1972-06-01 0.2683 0.1382 0.2613 0.15704 -0.021820506

操作例

> dim(w)
[1] 612 5
> dplyr::filter(as.data.frame(w[seq(9,612,12),]),g20>0,g7>0,usa>0,nfci<0) %>% dplyr::summarise(.,mean(spx))
mean(spx)
1 0.02789301
> dplyr::filter(as.data.frame(w[seq(9,612,12),]),g20>0,g7>0,usa>0,nfci<0) %>% dim()
[1] 7 5

8月のデータ

各種CLIのデルタがプラスかつnfciがルース方向の場合を考える。

> (dplyr::filter(as.data.frame(w[seq(8,dim(w)[1],12),] ),g20>0,usa>0,g7>0,nfci<0))[,5] %>% t.test(.,mu=0,alternative = 'greater')

One Sample t-test

data: .
t = 1.8595, df = 6, p-value = 0.05615
alternative hypothesis: true mean is greater than 0
95 percent confidence interval:
-0.001023011 Inf
sample estimates:
mean of x
0.02274507

結果の平均は0.02274507。そのp値は0.05615なので、95%検定にはぎりぎり不合格。対立仮説は平均がゼロより大きい場合、つまり片側検定を実施している。

この記事が気に入ったらサポートをしてみませんか?