def test_variance_ratio(self): vr = VarianceRatio(self.inflation, debiased=False) y = self.inflation dy = np.diff(y) mu = dy.mean() dy2 = y[2:] - y[:-2] nq = dy.shape[0] denom = np.sum((dy - mu) ** 2.0) / (nq) num = np.sum((dy2 - 2 * mu) ** 2.0) / (nq * 2) ratio = num / denom assert_almost_equal(ratio, vr.vr) assert 'Variance-Ratio Test' in str(vr) vr.debiased = True assert vr.debiased is True
def test_variance_ratio(self): vr = VarianceRatio(self.inflation, debiased=False) y = self.inflation dy = np.diff(y) mu = dy.mean() dy2 = y[2:] - y[:-2] nq = dy.shape[0] denom = np.sum((dy - mu)**2.0) / nq num = np.sum((dy2 - 2 * mu)**2.0) / (nq * 2) ratio = num / denom assert_almost_equal(ratio, vr.vr) assert "Variance-Ratio Test" in str(vr) with pytest.warns(FutureWarning, match="Mutating unit root"): vr.debiased = True assert vr.debiased is True