Dickey Fuller 1

Overview


The Dickey Fuller test assumes a model of the following form. It tests for the case where {% \rho = 1 %}.
{% y_t = \rho y_{t-1} + \epsilon_t %}
To simplify the problem, the model is restated as
{% y_t - y_{t-1} = (\rho - 1) y_{t-1} + \epsilon_t %}
which can be restated as
{% \Delta y_t = \gamma y_{t-1} + v_t %}
In this new form, {% \rho = 1 %} is equivalent to {% \gamma = 0 %}. To test whether {% \gamma = 0 %} is similar to running any normal regression and testing whether a given coefficient is zero using the coefficients t-value.

However, in a Dickey Fuller test, the T-value is ditributed with the Dickey Fuller distribution

1% 5% 10%
-2.56 -1.94 -1.62

Implementation



let ol = await import('/lib/ols-regression/v1.0.0/ols-regression.mjs');

let data = [{value:0},{value:1},{value:1.3},{value:2},{value:1.8},{value:1.6},{value:1.3},{value:1.9},{value:2.1},
    {value:2.1},{value:2},{value:1.9},];

let tdata = data.map((p,i,data)=>{
  if(i===0) return;
  return {
    delta:p.value-data[i-1].value,
    y:data[i-1].value
  }
}).filter(p=>p!==undefined);

let params = {
  data: tdata,
  y: 'delta',
  x: ['y'],
  intercept:false
};
let reg = ol.regressDataSet(params);
let tvalue = reg.TValues.y
					
Try it!

Contents