時系列チャート 単位根検定 共和分検定 最小二乗法 一般化最小二乗法 散布図・QQプロット・残差の時系列推移
[1] "USDJPY"
Date Open High Low Close Center Index CloseToOpen HighToLow MA25 DeviationRate Close:Diff(lag=1) Close:Ratio(lag=1)
855 2019-08-05 106.57 106.68 105.79 105.95 106.03 108.13 -0.582 0.841 108.1252 -2.01 -0.97 -0.907
856 2019-08-06 105.62 107.08 105.52 106.38 105.60 107.39 0.720 1.478 108.0472 -1.54 0.43 0.406
857 2019-08-07 106.33 106.45 105.94 106.30 106.15 107.79 -0.028 0.481 107.9684 -1.55 -0.08 -0.075
858 2019-08-08 106.11 106.32 106.00 106.11 106.11 107.80 0.000 0.302 107.9028 -1.66 -0.19 -0.179
859 2019-08-09 105.89 106.07 105.77 105.95 105.98 108.36 0.057 0.284 107.8284 -1.74 -0.16 -0.151
860 2019-08-13 105.38 105.58 105.13 105.20 105.43 107.17 -0.171 0.428 107.7140 -2.33 -0.75 -0.708
861 2019-08-14 106.61 106.70 106.24 106.45 106.36 108.24 -0.150 0.433 107.6380 -1.10 1.25 1.188
862 2019-08-15 105.92 106.77 105.76 106.25 105.93 108.02 0.312 0.955 107.5352 -1.20 -0.20 -0.188
863 2019-08-16 106.10 106.27 106.03 106.17 106.15 107.78 0.066 0.226 107.4236 -1.17 -0.08 -0.075
864 2019-08-19 106.43 106.47 106.25 106.41 106.38 107.69 -0.019 0.207 107.3576 -0.88 0.24 0.226
865 2019-08-20 106.57 106.69 106.40 106.47 106.56 108.03 -0.094 0.273 107.2816 -0.76 0.06 0.056
866 2019-08-21 106.28 106.60 106.25 106.55 106.47 107.61 0.254 0.329 107.2208 -0.63 0.08 0.075
867 2019-08-22 106.60 106.65 106.30 106.45 106.45 107.98 -0.141 0.329 107.1480 -0.65 -0.10 -0.094
868 2019-08-23 106.47 106.67 106.43 106.65 106.55 109.07 0.169 0.226 107.1032 -0.42 0.20 0.188
869 2019-08-26 104.85 105.95 104.46 105.74 105.25 NA 0.849 1.426 107.0268 -1.20 -0.91 -0.853
[1] "NIKKEI"
Date Open High Low Close CloseToOpen HighToLow MA25 DeviationRate Close:Diff(lag=1) Close:Ratio(lag=1)
855 2019-08-05 20909.98 20941.83 20514.19 20720.29 -0.907 2.085 21536.37 -3.79 -366.87 -1.740
856 2019-08-06 20325.52 20607.83 20110.76 20585.31 1.278 2.472 21490.59 -4.21 -134.98 -0.651
857 2019-08-07 20548.07 20570.19 20406.52 20516.56 -0.153 0.802 21441.08 -4.31 -68.75 -0.334
858 2019-08-08 20529.29 20682.24 20462.98 20593.35 0.312 1.071 21399.29 -3.77 76.79 0.374
859 2019-08-09 20758.15 20782.06 20676.92 20684.82 -0.353 0.508 21358.58 -3.15 91.47 0.444
860 2019-08-13 20432.68 20503.38 20369.27 20455.44 0.111 0.658 21306.94 -4.00 -229.38 -1.109
861 2019-08-14 20669.99 20697.42 20581.17 20655.13 -0.072 0.565 21271.77 -2.90 199.69 0.976
862 2019-08-15 20324.25 20419.88 20184.85 20405.65 0.401 1.164 21225.39 -3.86 -249.48 -1.208
863 2019-08-16 20323.97 20465.71 20300.35 20418.81 0.467 0.815 21180.81 -3.60 13.16 0.064
864 2019-08-19 20590.47 20633.90 20502.66 20563.16 -0.133 0.640 21137.59 -2.72 144.35 0.707
865 2019-08-20 20605.35 20684.06 20582.01 20677.22 0.349 0.496 21097.25 -1.99 114.06 0.555
866 2019-08-21 20489.97 20626.05 20482.62 20618.57 0.628 0.700 21060.58 -2.10 -58.65 -0.284
867 2019-08-22 20706.07 20731.19 20584.29 20628.01 -0.377 0.714 21026.93 -1.90 9.44 0.046
868 2019-08-23 20579.98 20719.31 20579.98 20710.91 0.636 0.677 21013.52 -1.44 82.90 0.402
869 2019-08-26 20325.44 20329.01 20173.76 20261.04 -0.317 0.770 20965.28 -3.36 -449.87 -2.172
Analysis period: 2019-05-31 ~ 2019-08-26,60days
$USDJPY_CloseToOpen
ADF test
data: x
ADF(1) = -6.9434, p-value = 0.00000121
alternative hypothesis: true delta is less than 0
sample estimates:
delta
-1.533123
$NIKKEI_CloseToOpen
ADF test
data: x
ADF(0) = -10.28, p-value = 0.0000000001205
alternative hypothesis: true delta is less than 0
sample estimates:
delta
-1.328412
Analysis period: 2019-05-31 ~ 2019-08-26,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.44301 -0.15925 -0.02511 0.07655 0.91662
Coefficients:
Estimate Std. Error t value Pr(>|t|)
z[, -1] 0.21331 0.05369 3.973 0.000196 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2182 on 59 degrees of freedom
Multiple R-squared: 0.211, Adjusted R-squared: 0.1977
F-statistic: 15.78 on 1 and 59 DF, p-value: 0.0001959
Value of test-statistic is: 44.9729
Critical values of Pu are:
10pct 5pct 1pct
critical values 20.3933 25.9711 38.3413
Analysis period: 2019-05-31 ~ 2019-08-26,60days
Call:
lm(formula = USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen, data = USDJPY_NIKKEI)
Residuals:
Min 1Q Median 3Q Max
-0.42027 -0.13520 -0.00275 0.09939 0.94284
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.02413 0.02853 -0.846 0.401116
NIKKEI_CloseToOpen 0.21991 0.05439 4.043 0.000157 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2187 on 58 degrees of freedom
Multiple R-squared: 0.2199, Adjusted R-squared: 0.2065
F-statistic: 16.35 on 1 and 58 DF, p-value: 0.0001573
-----------------------------------------------------------------------------
Durbin-Watson test
data: OLS_Model
DW = 1.6479, p-value = 0.08994
alternative hypothesis: true autocorrelation is greater than 0
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsOLS
D = 0.10308, p-value = 0.5136
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
(Intercept) -0.08123885 0.03297624
NIKKEI_CloseToOpen 0.11104161 0.32877155
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsOLS
X-squared = 7.4389, df = 10, p-value = 0.6835
Analysis period: 2019-05-31 ~ 2019-08-26,60days
Call:
lm(formula = USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen - 1, data = USDJPY_NIKKEI)
Residuals:
Min 1Q Median 3Q Max
-0.44301 -0.15925 -0.02511 0.07655 0.91662
Coefficients:
Estimate Std. Error t value Pr(>|t|)
NIKKEI_CloseToOpen 0.21331 0.05369 3.973 0.000196 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2182 on 59 degrees of freedom
Multiple R-squared: 0.211, Adjusted R-squared: 0.1977
F-statistic: 15.78 on 1 and 59 DF, p-value: 0.0001959
-----------------------------------------------------------------------------
Durbin-Watson test
data: OLS_Model_no_intercept
DW = 1.6282, p-value = 0.09847
alternative hypothesis: true autocorrelation is greater than 0
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsOLS_no_intercept
D = 0.14298, p-value = 0.1559
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
NIKKEI_CloseToOpen 0.1058675 0.3207477
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsOLS_no_intercept
X-squared = 7.5784, df = 10, p-value = 0.6699
Analysis period: 2019-05-31 ~ 2019-08-26,60days
Generalized least squares fit by REML
Model: USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen
Data: USDJPY_NIKKEI
AIC BIC logLik
0.8517216 11.15394 4.574139
Correlation Structure: ARMA(1,1)
Formula: ~1
Parameter estimate(s):
Phi1 Theta1
-0.5790455 0.8274226
Coefficients:
Value Std.Error t-value p-value
(Intercept) -0.02279688 0.03149008 -0.723939 0.472
NIKKEI_CloseToOpen 0.21564166 0.04374439 4.929584 0.000
Correlation:
(Intr)
NIKKEI_CloseToOpen -0.093
Standardized residuals:
Min Q1 Med Q3 Max
-1.9149399 -0.6208827 -0.0136277 0.4501184 4.2793579
Residual standard error: 0.2196954
Degrees of freedom: 60 total; 58 residual
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsGLS
D = 0.10344, p-value = 0.5092
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
(Intercept) -0.0845163 0.03892254
NIKKEI_CloseToOpen 0.1299042 0.30137909
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsGLS
X-squared = 7.529, df = 10, p-value = 0.6747
Analysis period: 2019-05-31 ~ 2019-08-26,60days
Generalized least squares fit by REML
Model: USDJPY_CloseToOpen ~ NIKKEI_CloseToOpen - 1
Data: USDJPY_NIKKEI
AIC BIC logLik
-5.705376 2.604774 6.852688
Correlation Structure: ARMA(1,1)
Formula: ~1
Parameter estimate(s):
Phi1 Theta1
-0.5761774 0.8236721
Coefficients:
Value Std.Error t-value p-value
NIKKEI_CloseToOpen 0.2123643 0.04350093 4.881833 0
Standardized residuals:
Min Q1 Med Q3 Max
-2.0245727 -0.7282230 -0.1135206 0.3508311 4.1895173
Residual standard error: 0.2187172
Degrees of freedom: 60 total; 59 residual
-----------------------------------------------------------------------------
One-sample Kolmogorov-Smirnov test
data: ResidualsGLS_no_intercept
D = 0.14248, p-value = 0.1587
alternative hypothesis: two-sided
-----------------------------------------------------------------------------
2.5 % 97.5 %
NIKKEI_CloseToOpen 0.127104 0.2976245
-----------------------------------------------------------------------------
Box-Ljung test
data: ResidualsGLS_no_intercept
X-squared = 7.5984, df = 10, p-value = 0.668