2018年7月23日月曜日

IRON ORE VIX and USDJPY



Download monthly Iron Ore price from this URL.

Dont' forget cut&paste table data into the terminal and format them by the editor

cat <INPUT CSV FILE NAME> |sed 's/,//' |awk '{print $1"-"$2","$3","$4}' >  <OUTPUT CSV FILE NAME>

IRON_ORE <- as.xts(as.numeric(read.csv("~/icloud/R/iron_ore_price.csv")[2:240,2]),seq(as.Date("1998-07-01"),as.Date("2018-05-01"),by="months"))

summary(lm(to.monthly(YJUSDJPY)["2008::2017"][,4] ~ to.monthly(VIX)["2008::2017"][,4] + to.monthly(IRON_ORE)["2008::2017"][,4]))

> summary(lm(to.monthly(YJUSDJPY)["2008::2017"][,4] ~ to.monthly(VIX)["2008::2017"][,4] + to.monthly(IRON_ORE)["2008::2017"][,4]))



Call:

lm(formula = to.monthly(YJUSDJPY)["2008::2017"][, 4] ~ to.monthly(VIX)["2008::2017"][, 4] + to.monthly(IRON_ORE)["2008::2017"][, 4])

Residuals:
    Min      1Q  Median      3Q     Max
-32.025  -9.121   0.750   7.764  25.368

Coefficients:
                                                     Estimate Std. Error t value Pr(>|t|) 
(Intercept)                                    98.2969     3.0042  32.720  < 2e-16 ***
to.monthly(VIX)["2008::2017"][, 4]       -0.5002     0.1147  -4.361 2.80e-05 ***
to.monthly(IRON_ORE)["2008::2017"][, 4]   0.1470     0.0238   6.179 9.69e-09 ***

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 11.57 on 117 degrees of freedom
Multiple R-squared:  0.316, Adjusted R-squared:  0.3043
F-statistic: 27.02 on 2 and 117 DF,  p-value: 2.249e-10



plot(merge(to.monthly(YJUSDJPY["2008::2017"])[,4],predict(lm(to.monthly(YJUSDJPY)["2008::2017"][,4] ~ to.monthly(VIX)["2008::2017"][,4] + to.monthly(IRON_ORE)["2008::2017"][,4]))))

0 件のコメント: