時系列チャート 単位根検定 共和分検定 最小二乗法 一般化最小二乗法 散布図・QQプロット・残差の時系列推移
[1] "USDJPY"
Date Open High Low Close Center Index CloseToOpen HighToLow MA:25 DeviationRate Close:Diff(lag=1) Close:Ratio(lag=1)
824 2019-06-20 108.11 108.14 107.47 107.68 107.65 104.81 -0.398 0.623 108.9300 -1.15 -0.71 -0.655
825 2019-06-21 107.31 107.53 107.05 107.46 107.10 104.80 0.140 0.448 108.8392 -1.27 -0.22 -0.204
826 2019-06-24 107.31 107.48 107.27 107.42 107.40 104.70 0.103 0.196 108.7312 -1.21 -0.04 -0.037
827 2019-06-25 107.34 107.41 106.78 107.05 107.00 104.93 -0.270 0.590 108.6080 -1.43 -0.37 -0.344
828 2019-06-26 107.18 107.50 107.11 107.46 107.36 104.30 0.261 0.364 108.4916 -0.95 0.41 0.383
829 2019-06-27 107.75 108.15 107.64 108.05 108.08 104.24 0.278 0.474 108.4016 -0.32 0.59 0.549
830 2019-06-28 107.76 107.81 107.57 107.64 107.68 104.11 -0.111 0.223 108.3256 -0.63 -0.41 -0.379
831 2019-07-01 108.38 108.53 108.11 108.33 108.24 103.66 -0.046 0.388 108.2756 0.05 0.69 0.641
832 2019-07-02 108.38 108.47 108.24 108.27 108.42 104.32 -0.101 0.212 108.2296 0.04 -0.06 -0.055
833 2019-07-03 107.84 107.90 107.54 107.75 107.60 104.46 -0.083 0.335 108.1712 -0.39 -0.52 -0.480
834 2019-07-16 107.91 108.10 107.83 108.07 107.95 104.17 0.148 0.250 108.1040 -0.03 0.32 0.297
835 2019-07-17 108.20 108.33 108.12 108.27 108.17 104.43 0.065 0.194 108.0836 0.17 0.20 0.185
836 2019-07-18 107.94 107.97 107.62 107.77 107.70 104.85 -0.157 0.325 108.0644 -0.27 -0.50 -0.462
837 2019-07-19 107.41 107.71 107.22 107.65 107.50 104.61 0.223 0.457 108.0484 -0.37 -0.12 -0.111
838 2019-07-22 107.83 108.07 107.71 107.87 107.96 NA 0.037 0.334 108.0332 -0.15 0.22 0.204
[1] "NIKKEI"
Date Open High Low Close CloseToOpen HighToLow MA:25 DeviationRate Close:Diff(lag=1) Close:Ratio(lag=1)
824 2019-06-20 21417.74 21491.39 21377.27 21462.86 0.211 0.534 21045.23 1.98 128.99 0.605
825 2019-06-21 21487.67 21497.82 21221.70 21258.64 -1.066 1.301 21045.58 1.01 -204.22 -0.952
826 2019-06-24 21223.56 21317.86 21185.67 21285.99 0.294 0.624 21044.95 1.15 27.35 0.129
827 2019-06-25 21238.07 21313.77 21114.47 21193.81 -0.208 0.944 21041.80 0.72 -92.18 -0.433
828 2019-06-26 21067.68 21129.64 21035.84 21086.59 0.090 0.446 21033.93 0.25 -107.22 -0.506
829 2019-06-27 21156.88 21338.17 21123.97 21338.17 0.857 1.014 21041.41 1.41 251.58 1.193
830 2019-06-28 21282.22 21324.93 21199.85 21275.92 -0.030 0.590 21047.76 1.08 -62.25 -0.292
831 2019-07-01 21566.27 21758.34 21559.17 21729.97 0.759 0.924 21069.65 3.13 454.05 2.134
832 2019-07-02 21699.43 21784.22 21697.31 21754.27 0.253 0.401 21089.42 3.15 24.30 0.112
833 2019-07-03 21684.07 21708.72 21566.65 21638.16 -0.212 0.659 21114.81 2.48 -116.11 -0.534
834 2019-07-16 21644.38 21655.52 21514.89 21535.25 -0.504 0.654 21395.37 0.65 -150.65 -0.695
835 2019-07-17 21474.63 21488.27 21380.55 21469.18 -0.025 0.504 21405.97 0.30 -66.07 -0.307
836 2019-07-18 21336.80 21347.84 20993.44 21046.24 -1.362 1.688 21402.63 -1.67 -422.94 -1.970
837 2019-07-19 21146.50 21474.30 21121.90 21466.99 1.516 1.668 21420.03 0.22 420.75 1.999
838 2019-07-22 21394.75 21445.03 21317.85 21416.79 0.103 0.597 21432.03 -0.07 -50.20 -0.234
Analysis period: 2019-04-10 ~ 2019-07-22,60days
$USDJPY_CloseToOpen
ADF test
data: x
ADF(0) = -8.4688, p-value = 0.000000009732
alternative hypothesis: true delta is less than 0
sample estimates:
delta
-1.123136
$NIKKEI_CloseToOpen
ADF test
data: x
ADF(0) = -9.1263, p-value = 0.000000001598
alternative hypothesis: true delta is less than 0
sample estimates:
delta
-1.207359
Analysis period: 2019-04-10 ~ 2019-07-22,60days
########################################
# Phillips and Ouliaris Unit Root Test #
########################################
Test of type Pu
detrending of series none
Call:
lm(formula = z[, 1] ~ z[, -1] - 1)
Residuals:
Min 1Q Median 3Q Max
-0.42798 -0.12645 -0.02998 0.05326 0.34230
Coefficients:
Estimate Std. Error t value Pr(>|t|)
z[, -1] 0.14208 0.03963 3.585 0.000684 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1585 on 59 degrees of freedom
Multiple R-squared: 0.1789, Adjusted R-squared: 0.165
F-statistic: 12.85 on 1 and 59 DF, p-value: 0.0006837
Value of test-statistic is: 55.4494
Critical values of Pu are:
10pct 5pct 1pct
critical values 20.3933 25.9711 38.3413
Analysis period: 2019-04-10 ~ 2019-07-22,60days
Call:
lm(formula = USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen, data = USDJPY_NIKKEI)
Residuals:
Min 1Q Median 3Q Max
-0.39323 -0.09038 0.00503 0.09108 0.37200
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.03621 0.02018 -1.794 0.077973 .
NIKKEI_CloseToOpen 0.14900 0.03909 3.811 0.000337 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1556 on 58 degrees of freedom
Multiple R-squared: 0.2003, Adjusted R-squared: 0.1865
F-statistic: 14.53 on 1 and 58 DF, p-value: 0.0003366
-----------------------------------------------------------------------------
Durbin-Watson test
data: OLS_Model
DW = 2.2138, p-value = 0.8049
alternative hypothesis: true autocorrelation is greater than 0
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsOLS
D = 0.079467, p-value = 0.8141
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
(Intercept) -0.07660713 0.004185337
NIKKEI_CloseToOpen 0.07074981 0.227257906
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsOLS
X-squared = 0.75006, df = 1, p-value = 0.3865
Analysis period: 2019-04-10 ~ 2019-07-22,60days
Call:
lm(formula = USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen - 1, data = USDJPY_NIKKEI)
Residuals:
Min 1Q Median 3Q Max
-0.42798 -0.12645 -0.02998 0.05326 0.34230
Coefficients:
Estimate Std. Error t value Pr(>|t|)
NIKKEI_CloseToOpen 0.14208 0.03963 3.585 0.000684 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1585 on 59 degrees of freedom
Multiple R-squared: 0.1789, Adjusted R-squared: 0.165
F-statistic: 12.85 on 1 and 59 DF, p-value: 0.0006837
-----------------------------------------------------------------------------
Durbin-Watson test
data: OLS_Model_no_intercept
DW = 2.0939, p-value = 0.6992
alternative hypothesis: true autocorrelation is greater than 0
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsOLS_no_intercept
D = 0.08357, p-value = 0.7646
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
NIKKEI_CloseToOpen 0.0627839 0.2213726
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsOLS_no_intercept
X-squared = 0.71873, df = 1, p-value = 0.3966
Analysis period: 2019-04-10 ~ 2019-07-22,60days
Generalized least squares fit by REML
Model: USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen
Data: USDJPY_NIKKEI
AIC BIC logLik
-38.39366 -32.21233 22.19683
Coefficients:
Value Std.Error t-value p-value
(Intercept) -0.0362109 0.02018079 -1.794325 0.0780
NIKKEI_CloseToOpen 0.1490039 0.03909345 3.811478 0.0003
Correlation:
(Intr)
NIKKEI_CloseToOpen -0.099
Standardized residuals:
Min Q1 Med Q3 Max
-2.52789372 -0.58101880 0.03235391 0.58552555 2.39141133
Residual standard error: 0.155556
Degrees of freedom: 60 total; 58 residual
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsGLS
D = 0.079467, p-value = 0.8141
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
(Intercept) -0.07576451 0.003342719
NIKKEI_CloseToOpen 0.07238209 0.225625618
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsGLS
X-squared = 0.75006, df = 1, p-value = 0.3865
Analysis period: 2019-04-10 ~ 2019-07-22,60days
Generalized least squares fit by REML
Model: USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen - 1
Data: USDJPY_NIKKEI
AIC BIC logLik
-43.18296 -39.02789 23.59148
Coefficients:
Value Std.Error t-value p-value
NIKKEI_CloseToOpen 0.1420783 0.03962746 3.585349 0.0007
Standardized residuals:
Min Q1 Med Q3 Max
-2.7009471 -0.7980066 -0.1891916 0.3361123 2.1602626
Residual standard error: 0.158455
Degrees of freedom: 60 total; 59 residual
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsGLS_no_intercept
D = 0.08357, p-value = 0.7646
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
NIKKEI_CloseToOpen 0.06440987 0.2197466
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsGLS_no_intercept
X-squared = 0.71873, df = 1, p-value = 0.3966