Ejemplo n.º 1
0
 def test_kpss_c(self):
     kpss = KPSS(self.inflation, trend="c", lags=12)
     assert_almost_equal(kpss.stat, 0.3276290340191141, DECIMAL_4)
Ejemplo n.º 2
0
 def test_kpss(self):
     kpss = KPSS(self.inflation, trend='ct', lags=12)
     assert_almost_equal(kpss.stat, .235581902996454, DECIMAL_4)
     assert_equal(self.inflation.shape[0], kpss.nobs)
     kpss.summary()
Ejemplo n.º 3
0
 def test_kpss(self):
     kpss = KPSS(self.inflation, trend="ct", lags=12)
     assert_almost_equal(kpss.stat, 0.235581902996454, DECIMAL_4)
     assert_equal(self.inflation.shape[0], kpss.nobs)
     kpss.summary()
Ejemplo n.º 4
0
 def test_kpss_auto(self):
     kpss = KPSS(self.inflation, lags=-1)
     m = self.inflation.shape[0]
     lags = np.ceil(12.0 * (m / 100)**(1.0 / 4))
     assert_equal(kpss.lags, lags)
Ejemplo n.º 5
0
def test_kpss_legacy():
    y = np.random.standard_normal(4)
    with pytest.raises(InfeasibleTestException,
                       match="The number of observations 4"):
        assert np.isfinite(KPSS(y, lags=-1).stat)
Ejemplo n.º 6
0
def test_kpss_data_dependent_lags(data, trend, lags):
    # real GDP from macrodata data set
    kpss = KPSS(data, trend=trend)
    assert_equal(kpss.lags, lags)
Ejemplo n.º 7
0
lh = np.log(data / data.shift(1)).dropna()  # d 1

garch_plot1(lh['Close'])
print('Lean Hogs Future skewness is {}'.format(lh.skew(axis=0)[0]))
print('Lean Hogs Future kurtosis is {}'.format(lh.kurtosis(axis=0)[0]))

sns.distplot(lh['Close'], color='blue')  #density plot
plt.title('1986–2018 Lean Hogs Future return frequency')
plt.xlabel('Possible range of data values')
# Pull up summary statistics
print(lh.describe())

adf = ADF(lh['Close'])
print(adf.summary().as_text())
kpss = KPSS(lh['Close'])
print(kpss.summary().as_text())
dfgls = DFGLS(lh['Close'])
print(dfgls.summary().as_text())
pp = PhillipsPerron(lh['Close'])
print(pp.summary().as_text())
za = ZivotAndrews(lh['Close'])
print(za.summary().as_text())
vr = VarianceRatio(lh['Close'], 12)
print(vr.summary().as_text())

from arch import arch_model

X = 100 * lh

import datetime as dt