CLIおよびNFCIおよび指数の季節性 h.onomoto 2023年7月26日 11:35 データの準備> TERM[1] "1972::2022"の時、以下の操作で都合の良いデータセットを作る。merge(g20=diff(cli_g20)[TERM],usa=diff(cli_usa)[TERM],g7=diff(cli_g7)[TERM])-> wmerge(w,nfci=as.vector(diff(to.monthly(NFCI)[,4])[TERM]),spx=as.vector(monthlyReturn(GSPC)[TERM])) -> w結果は以下の通り> head(w)g20 usa g7 nfci spx1972-01-01 0.3511 0.3964 0.3522 -0.38910 0.0181213251972-02-01 0.3545 0.3540 0.3532 -0.37591 0.0253030401972-03-01 0.3428 0.2773 0.3392 -0.19033 0.0059115791972-04-01 0.3225 0.2043 0.3169 -0.16699 0.0043843381972-05-01 0.2943 0.1567 0.2876 -0.15576 0.0172750171972-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 58月のデータ各種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-testdata: .t = 1.8595, df = 6, p-value = 0.05615alternative hypothesis: true mean is greater than 095 percent confidence interval: -0.001023011 Infsample estimates: mean of x 0.02274507 結果の平均は0.02274507。そのp値は0.05615なので、95%検定にはぎりぎり不合格。対立仮説は平均がゼロより大きい場合、つまり片側検定を実施している。 ダウンロード copy #t検定 この記事が気に入ったらサポートをしてみませんか? サポート