Alfa Investor In A Good Mood
Return Calculus R
price4<- span=""> read.table('price4.txt',header = T)
price4[1:3,]->
## x5202 x7272 x4927 x4502
## 1 55 682 2460 3595
## 2 56 672 2543 3575
## 3 56 668 2544 3570
summary(price4)
## x5202 x7272 x4927 x4502
## Min. : 55.0 Min. : 668.0 Min. :2363 Min. :3500
## 1st Qu.: 73.0 1st Qu.: 780.0 1st Qu.:2467 1st Qu.:3710
## Median : 96.0 Median : 948.0 Median :2525 Median :3865
## Mean : 92.4 Mean : 968.8 Mean :2633 Mean :4199
## 3rd Qu.:110.0 3rd Qu.:1098.0 3rd Qu.:2832 3rd Qu.:4700
## Max. :124.0 Max. :1334.0 Max. :3085 Max. :5280
NipponSheetGlassCompany_TSE5202<- span=""> price4$x5202
PolaOrbisHoldings_TSE4927<- span=""> price4$x4927
YamahaMotor_TSE7272<- span=""> price4$x7272
TakedaPharmaceuticalCompany_TSE4502<- span=""> price4$x4502
par(mfcol=c(2,2))
plot(NipponSheetGlassCompany_TSE5202,type="l"
,main="NipponSheetGlassCompany_TSE5202")
plot(PolaOrbisHoldings_TSE4927,type="l"
,main="PolaOrbisHoldings_TSE4927")
plot(YamahaMotor_TSE7272,type="l"
,main="YamahaMotor_TSE7272")
plot(TakedaPharmaceuticalCompany_TSE4502,type="l"
,main="TakedaPharmaceuticalCompany_TSE4502")->->->->
時系列の始点を基準として、価格収益率を求める
par(mfcol=c(2,2))
plot(NipponSheetGlassCompany_TSE5202/NipponSheetGlassCompany_TSE5202[1]
,type="l",main="NipponSheetGlassCompany_TSE5202")
plot(PolaOrbisHoldings_TSE4927/PolaOrbisHoldings_TSE4927[1]
,type="l",main="PolaOrbisHoldings_TSE4927")
plot(YamahaMotor_TSE7272/YamahaMotor_TSE7272[1]
,type="l",main="YamahaMotor_TSE7272")
plot(TakedaPharmaceuticalCompany_TSE4502/TakedaPharmaceuticalCompany_TSE4502[1]
,type="l",main="TakedaPharmaceuticalCompany_TSE4502")
判明した点 板硝子は最高で2.2倍に株価が成長した
次に対数差収益を求める##
par(mfcol=c(2,2))
plot(diff(log(NipponSheetGlassCompany_TSE5202)*100)
,type="l",main="NipponSheetGlassCompany_TSE5202"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(PolaOrbisHoldings_TSE4927)*100)
,type="l",main="PolaOrbisHoldings_TSE4927"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(YamahaMotor_TSE7272)*100)
,type="l",main="YamahaMotor_TSE7272"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(TakedaPharmaceuticalCompany_TSE4502)*100)
,type="l",main="TakedaPharmaceuticalCompany_TSE4502"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
結論 板硝子とYamahaMotor_TSE7272のボラは高い。一方、武田薬品のそれは低い
par(mfcol=c(2,2))
plot(diff(log(NipponSheetGlassCompany_TSE5202)*100)
,type="l",main="NipponSheetGlassCompany_TSE5202"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202"
,ylim=range(diff(log(NipponSheetGlassCompany_TSE5202))*100))
plot(diff(log(PolaOrbisHoldings_TSE4927)*100)
,type="l",main="PolaOrbisHoldings_TSE4927"
,xlab="time",ylab="PolaOrbisHoldings_TSE4927"
,ylim=range(diff(log(PolaOrbisHoldings_TSE4927))*100))
plot(diff(log(YamahaMotor_TSE7272)*100)
,type="l",main="YamahaMotor_TSE7272"
,xlab="time",ylab="YamahaMotor_TSE7272"
,ylim=range(diff(log(YamahaMotor_TSE7272))*100))
plot(diff(log(TakedaPharmaceuticalCompany_TSE4502)*100)
,type="l",main="TakedaPharmaceuticalCompany_TSE4502"
,xlab="time",ylab="TakedaPharmaceuticalCompany_TSE4502"
,ylim=range(diff(log(TakedaPharmaceuticalCompany_TSE4502))*100))
################################## ########時系列データ分布と要約########### ##4銘柄の平均収益率
mean(TakedaPharmaceuticalCompany_TSE4502)
## [1] 4199.38
mean(PolaOrbisHoldings_TSE4927)
## [1] 2633.157
mean(NipponSheetGlassCompany_TSE5202)
## [1] 92.39669
mean(YamahaMotor_TSE7272)
## [1] 968.8264
price4<- span=""> read.table('price4.txt',header = T)
price4[1:3,]->
## x5202 x7272 x4927 x4502
## 1 55 682 2460 3595
## 2 56 672 2543 3575
## 3 56 668 2544 3570
summary(price4)
## x5202 x7272 x4927 x4502
## Min. : 55.0 Min. : 668.0 Min. :2363 Min. :3500
## 1st Qu.: 73.0 1st Qu.: 780.0 1st Qu.:2467 1st Qu.:3710
## Median : 96.0 Median : 948.0 Median :2525 Median :3865
## Mean : 92.4 Mean : 968.8 Mean :2633 Mean :4199
## 3rd Qu.:110.0 3rd Qu.:1098.0 3rd Qu.:2832 3rd Qu.:4700
## Max. :124.0 Max. :1334.0 Max. :3085 Max. :5280
NipponSheetGlassCompany_TSE5202<- span=""> price4$x5202
PolaOrbisHoldings_TSE4927<- span=""> price4$x4927
YamahaMotor_TSE7272<- span=""> price4$x7272
TakedaPharmaceuticalCompany_TSE4502<- span=""> price4$x4502
par(mfcol=c(2,2))
plot(NipponSheetGlassCompany_TSE5202,type="l"
,main="NipponSheetGlassCompany_TSE5202")
plot(PolaOrbisHoldings_TSE4927,type="l"
,main="PolaOrbisHoldings_TSE4927")
plot(YamahaMotor_TSE7272,type="l"
,main="YamahaMotor_TSE7272")
plot(TakedaPharmaceuticalCompany_TSE4502,type="l"
,main="TakedaPharmaceuticalCompany_TSE4502")->->->->
par(mfcol=c(2,2))
plot(NipponSheetGlassCompany_TSE5202/NipponSheetGlassCompany_TSE5202[1]
,type="l",main="NipponSheetGlassCompany_TSE5202")
plot(PolaOrbisHoldings_TSE4927/PolaOrbisHoldings_TSE4927[1]
,type="l",main="PolaOrbisHoldings_TSE4927")
plot(YamahaMotor_TSE7272/YamahaMotor_TSE7272[1]
,type="l",main="YamahaMotor_TSE7272")
plot(TakedaPharmaceuticalCompany_TSE4502/TakedaPharmaceuticalCompany_TSE4502[1]
,type="l",main="TakedaPharmaceuticalCompany_TSE4502")
par(mfcol=c(2,2))
plot(diff(log(NipponSheetGlassCompany_TSE5202)*100)
,type="l",main="NipponSheetGlassCompany_TSE5202"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(PolaOrbisHoldings_TSE4927)*100)
,type="l",main="PolaOrbisHoldings_TSE4927"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(YamahaMotor_TSE7272)*100)
,type="l",main="YamahaMotor_TSE7272"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
plot(diff(log(TakedaPharmaceuticalCompany_TSE4502)*100)
,type="l",main="TakedaPharmaceuticalCompany_TSE4502"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202")
par(mfcol=c(2,2))
plot(diff(log(NipponSheetGlassCompany_TSE5202)*100)
,type="l",main="NipponSheetGlassCompany_TSE5202"
,xlab="time",ylab="NipponSheetGlassCompany_TSE5202"
,ylim=range(diff(log(NipponSheetGlassCompany_TSE5202))*100))
plot(diff(log(PolaOrbisHoldings_TSE4927)*100)
,type="l",main="PolaOrbisHoldings_TSE4927"
,xlab="time",ylab="PolaOrbisHoldings_TSE4927"
,ylim=range(diff(log(PolaOrbisHoldings_TSE4927))*100))
plot(diff(log(YamahaMotor_TSE7272)*100)
,type="l",main="YamahaMotor_TSE7272"
,xlab="time",ylab="YamahaMotor_TSE7272"
,ylim=range(diff(log(YamahaMotor_TSE7272))*100))
plot(diff(log(TakedaPharmaceuticalCompany_TSE4502)*100)
,type="l",main="TakedaPharmaceuticalCompany_TSE4502"
,xlab="time",ylab="TakedaPharmaceuticalCompany_TSE4502"
,ylim=range(diff(log(TakedaPharmaceuticalCompany_TSE4502))*100))
mean(TakedaPharmaceuticalCompany_TSE4502)
## [1] 4199.38
mean(PolaOrbisHoldings_TSE4927)
## [1] 2633.157
mean(NipponSheetGlassCompany_TSE5202)
## [1] 92.39669
mean(YamahaMotor_TSE7272)
## [1] 968.8264
4銘柄のボラティリティ
sd(NipponSheetGlassCompany_TSE5202)
## [1] 20.12854
sd(PolaOrbisHoldings_TSE4927)
## [1] 209.8629
sd(YamahaMotor_TSE7272)
## [1] 187.3384
sd(TakedaPharmaceuticalCompany_TSE4502)
## [1] 571.4873
sd(NipponSheetGlassCompany_TSE5202)
## [1] 20.12854
sd(PolaOrbisHoldings_TSE4927)
## [1] 209.8629
sd(YamahaMotor_TSE7272)
## [1] 187.3384
sd(TakedaPharmaceuticalCompany_TSE4502)
## [1] 571.4873
μ、σ、histgram
par(mfcol=c(2,2))
hist(NipponSheetGlassCompany_TSE5202,main="NipponSheetGlassCompany_TSE5202")
hist(PolaOrbisHoldings_TSE4927,main="PolaOrbisHoldings_TSE4927")
hist(YamahaMotor_TSE7272,main="YamahaMotor_TSE7272")
hist(TakedaPharmaceuticalCompany_TSE4502,main="TakedaPharmaceuticalCompany_TSE4502")
par(mfcol=c(2,2))
hist(NipponSheetGlassCompany_TSE5202,main="NipponSheetGlassCompany_TSE5202")
hist(PolaOrbisHoldings_TSE4927,main="PolaOrbisHoldings_TSE4927")
hist(YamahaMotor_TSE7272,main="YamahaMotor_TSE7272")
hist(TakedaPharmaceuticalCompany_TSE4502,main="TakedaPharmaceuticalCompany_TSE4502")
散布図行列
cor(YamahaMotor_TSE7272,TakedaPharmaceuticalCompany_TSE4502)
## [1] 0.9539355
plot(price4)
cor(price4)##相関係数行列
## x5202 x7272 x4927 x4502
## x5202 1.0000000 0.8851551 0.7087943 0.8293775
## x7272 0.8851551 1.0000000 0.8705264 0.9539355
## x4927 0.7087943 0.8705264 1.0000000 0.9455436
## x4502 0.8293775 0.9539355 0.9455436 1.0000000
cor(YamahaMotor_TSE7272,TakedaPharmaceuticalCompany_TSE4502)
## [1] 0.9539355
plot(price4)
cor(price4)##相関係数行列
## x5202 x7272 x4927 x4502
## x5202 1.0000000 0.8851551 0.7087943 0.8293775
## x7272 0.8851551 1.0000000 0.8705264 0.9539355
## x4927 0.7087943 0.8705264 1.0000000 0.9455436
## x4502 0.8293775 0.9539355 0.9455436 1.0000000
Shapiro-Wilk検定
shapiro.test(PolaOrbisHoldings_TSE4927)
##
## Shapiro-Wilk normality test
##
## data: PolaOrbisHoldings_TSE4927
## W = 0.85788, p-value = 2.071e-09
shapiro.test(TakedaPharmaceuticalCompany_TSE4502)
##
## Shapiro-Wilk normality test
##
## data: TakedaPharmaceuticalCompany_TSE4502
## W = 0.86407, p-value = 3.767e-09
shapiro.test(NipponSheetGlassCompany_TSE5202)
##
## Shapiro-Wilk normality test
##
## data: NipponSheetGlassCompany_TSE5202
## W = 0.91089, p-value = 6.758e-07
shapiro.test(YamahaMotor_TSE7272)
##
## Shapiro-Wilk normality test
##
## data: YamahaMotor_TSE7272
## W = 0.94524, p-value = 9.178e-05
shapiro.test(PolaOrbisHoldings_TSE4927)
##
## Shapiro-Wilk normality test
##
## data: PolaOrbisHoldings_TSE4927
## W = 0.85788, p-value = 2.071e-09
shapiro.test(TakedaPharmaceuticalCompany_TSE4502)
##
## Shapiro-Wilk normality test
##
## data: TakedaPharmaceuticalCompany_TSE4502
## W = 0.86407, p-value = 3.767e-09
shapiro.test(NipponSheetGlassCompany_TSE5202)
##
## Shapiro-Wilk normality test
##
## data: NipponSheetGlassCompany_TSE5202
## W = 0.91089, p-value = 6.758e-07
shapiro.test(YamahaMotor_TSE7272)
##
## Shapiro-Wilk normality test
##
## data: YamahaMotor_TSE7272
## W = 0.94524, p-value = 9.178e-05
連の検定(runs test)
library(tseries)
yamaha=as.factor(YamahaMotor_TSE7272<mean(YamahaMotor_TSE7272))
runs.test(yamaha)
##
## Runs Test
##
## data: yamaha
## Standard Normal = -10.863, p-value < 2.2e-16
## alternative hypothesis: two.sided
Explore the time dependency for four stocks
par(mfcol=c(2,1))
plot(NipponSheetGlassCompany_TSE5202,type='l',main="NipponSheetGlassCompany_TSE5202")
plot(NipponSheetGlassCompany_TSE5202/NipponSheetGlassCompany_TSE5202[1]
,type="l",main="NipponSheetGlassCompany_TSE5202")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(NipponSheetGlassCompany_TSE5202,type = 'l',main="PolaOrbisHoldings_TSE4927")
plot(PolaOrbisHoldings_TSE4927/PolaOrbisHoldings_TSE4927[1]
,type="l",main="PolaOrbisHoldings_TSE4927")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(YamahaMotor_TSE7272,type = 'l',main="YamahaMotor_TSE7272")
plot(YamahaMotor_TSE7272/YamahaMotor_TSE7272[1]
,type="l",main="YamahaMotor_TSE7272")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(TakedaPharmaceuticalCompany_TSE4502,type = 'l',main="TakedaPharmaceuticalCompany_TSE4502")
plot(TakedaPharmaceuticalCompany_TSE4502/TakedaPharmaceuticalCompany_TSE4502[1]
,type="l",main="TakedaPharmaceuticalCompany_TSE4502")
abline(h=0,lty=3)
library(tseries)
yamaha=as.factor(YamahaMotor_TSE7272<mean(YamahaMotor_TSE7272))
runs.test(yamaha)
##
## Runs Test
##
## data: yamaha
## Standard Normal = -10.863, p-value < 2.2e-16
## alternative hypothesis: two.sided
Explore the time dependency for four stocks
par(mfcol=c(2,1))
plot(NipponSheetGlassCompany_TSE5202,type='l',main="NipponSheetGlassCompany_TSE5202")
plot(NipponSheetGlassCompany_TSE5202/NipponSheetGlassCompany_TSE5202[1]
,type="l",main="NipponSheetGlassCompany_TSE5202")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(NipponSheetGlassCompany_TSE5202,type = 'l',main="PolaOrbisHoldings_TSE4927")
plot(PolaOrbisHoldings_TSE4927/PolaOrbisHoldings_TSE4927[1]
,type="l",main="PolaOrbisHoldings_TSE4927")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(YamahaMotor_TSE7272,type = 'l',main="YamahaMotor_TSE7272")
plot(YamahaMotor_TSE7272/YamahaMotor_TSE7272[1]
,type="l",main="YamahaMotor_TSE7272")
abline(h=0,lty=3)
par(mfcol=c(2,1))
plot(TakedaPharmaceuticalCompany_TSE4502,type = 'l',main="TakedaPharmaceuticalCompany_TSE4502")
plot(TakedaPharmaceuticalCompany_TSE4502/TakedaPharmaceuticalCompany_TSE4502[1]
,type="l",main="TakedaPharmaceuticalCompany_TSE4502")
abline(h=0,lty=3)
Subscribe to:
Posts (Atom)
Nikkei225
28000-28550 up in the early session, down lately.
-
ECBによる資金供給や公的資金の投入が奏功し、欧州金融機関の融資余力が増しているようだ。 source- nikkei net
-
まず、米ドルの反対にある欧州単一通貨ユーロを考えることが米ドルの過去、未来を探るのに相応しいため、ユーロ・ドルの展望してみる。 本来ならば、ドル・円でと考えたが、ご承知のとおり、日本株、日本国債、日本外為市場などの東京市場は外国人から見れば、超巨大なローカル市場にすぎない。また、...