Step 1 regresses y1 on y2 by OLS; step 2 runs an
augmented Dickey-Fuller regression without deterministic terms on the
step-1 residuals, choosing the number of augmentation lags in
1..max_lag by AIC on a common sample. The ADF step is computed
natively and reproduces urca::ur.df(type = "none", lags =
max_lag, selectlags = "AIC") exactly; no external package is used.
The statistic is compared with the Engle-Granger (two-variable,
constant) critical values -3.90 / -3.34 / -3.04, not the plain
Dickey-Fuller ones, and p_value is a coarse bracket from them.
References
Engle, R. F. and Granger, C. W. J. (1987). Co-integration and error correction. Econometrica 55, 251-276.
Examples
set.seed(1)
morie_eg_coint(y1 = rnorm(100), y2 = rnorm(100))
#> $adf_statistic
#> [1] -6.40701
#>
#> $p_value
#> [1] 0.005
#>
#> $beta
#> [1] 0.1088521158 -0.0009323697
#>
#> $critical_values
#> 1% 5% 10%
#> -3.90 -3.34 -3.04
#>
#> $n
#> [1] 100
#>
#> $method
#> [1] "Engle-Granger 2-step cointegration (Engle & Granger 1987)"
#>
