2010年以降の月別日経平均株価前営業日比(%)の基本統計量

Data Source - Federal Reserve Bank of St. Louis , NIKKEI
Result
        Date NIKKEI225
1 1949-05-16    176.21
2 1949-05-17    174.80
3 1949-05-18    172.53
4 1949-05-19    171.34
5 1949-05-20    169.20
6 1949-05-23    171.85
            Date NIKKEI225
17389 2016-01-07  17767.34
17390 2016-01-08  17697.96
17392 2016-01-12  17218.96
17393 2016-01-13  17715.63
17394 2016-01-14  17240.95
17395 2016-01-15  17147.11
            Date dodNIKKEI225
15114 2010-01-04         1.03
15115 2010-01-05         0.25
15116 2010-01-06         0.46
15117 2010-01-07        -0.46
15118 2010-01-08         1.09
15119 2010-01-12         0.75
            Date dodNIKKEI225
16588 2016-01-07        -2.33
16589 2016-01-08        -0.39
16590 2016-01-12        -2.71
16591 2016-01-13         2.88
16592 2016-01-14        -2.68
16593 2016-01-15        -0.54

2010 年以降の月別日経平均前営業日比(%)の基本統計量
   Month   n       SD        Mean Median  Max    Min
1      1 123 1.380215 -0.07463415 -0.010 2.88  -3.08
2      2 116 1.301826  0.20094828  0.250 3.77  -4.18
3      3 127 1.698736  0.11960630  0.260 5.68 -10.55
4      4 124 1.171461  0.03983871 -0.035 3.01  -2.69
5      5 117 1.518053 -0.14205128  0.070 3.55  -7.32
6      6 128 1.514389  0.04140625  0.030 4.94  -6.35
7      7 128 1.130784  0.02898437  0.045 2.76  -3.32
8      8 132 1.444796 -0.19674242 -0.130 3.29  -4.61
9      9 117 1.571223  0.07709402  0.070 7.71  -4.05
10    10 127 1.304283  0.10307087  0.090 4.83  -2.75
11    11 118 1.167685  0.22245763  0.100 2.86  -2.96
12    12 123 1.086362  0.11105691  0.080 2.61  -2.25

2010 年以降の月別日経平均前営業日比(%)の最大値
            Date dodNIKKEI225
16511 2015-09-09         7.71

2010 年以降の月別日経平均前営業日比(%)の最小値
            Date dodNIKKEI225
15407 2011-03-15       -10.55
Script
library(lubridate)
onsetYear<-2010
variance<-function(x){var(x)*(length(x)-1)/length(x)}
#Reference http://cse.naro.affrc.go.jp/takezawa/r-tips/r/59.html
head(dataset)
tail(dataset)
doddataset<-round((dataset[-1,2]/dataset[-nrow(dataset),2]-1)*100,2)
doddataset<-data.frame(Date=dataset[-1,1],dodNIKKEI225=doddataset)
doddataset<-subset(doddataset,onsetYear<=year(doddataset[,1]))
head(doddataset)
tail(doddataset)
nikkei<-list()
result<-data.frame(
  Month=integer(),
  n=integer(), 
  SD=numeric(),
  Mean=numeric(),
  Median=numeric(),
  Max=numeric(),
  Min=numeric(),
  stringsAsFactors=F
) 
for(mmm in 1:12){
nikkei[[mmm]]<-subset(doddataset,month(doddataset[,1])==mmm)
result[mmm,1]<-mmm
result[mmm,2]<-nrow(nikkei[[mmm]])
result[mmm,3]<-sqrt(apply(nikkei[[mmm]][,-1,drop=F],2,variance))
result[mmm,4]<-apply(nikkei[[mmm]][,-1,drop=F],2,mean)
result[mmm,5]<-apply(nikkei[[mmm]][,-1,drop=F],2,median)
result[mmm,6]<-apply(nikkei[[mmm]][,-1,drop=F],2,max)
result[mmm,7]<-apply(nikkei[[mmm]][,-1,drop=F],2,min)
}
cat(onsetYear,"年以降の月別日経平均前営業日比(%)の基本統計量")
result
cat(onsetYear,"年以降の月別日経平均前営業日比(%)の最大値")
subset(doddataset,max(doddataset[,2])==doddataset[,2])
cat(onsetYear,"年以降の月別日経平均前営業日比(%)の最小値")
subset(doddataset,min(doddataset[,2])==doddataset[,2])