Skip to content

Commit

Permalink
Merge 9f9822d into 0325caa
Browse files Browse the repository at this point in the history
  • Loading branch information
bashtage committed Oct 1, 2018
2 parents 0325caa + 9f9822d commit dc3528a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions arch/tests/univariate/test_base.py
@@ -0,0 +1,10 @@
from arch.univariate.base import format_float_fixed


def test_format_float_fixed():
out = format_float_fixed(0.0)
assert out == '0.0000'
out = format_float_fixed(1.23e-9)
assert out == '1.2300e-09'
out = format_float_fixed(123456789.0)
assert out == '1.2346e+08'
6 changes: 6 additions & 0 deletions arch/tests/univariate/test_mean.py
Expand Up @@ -364,6 +364,11 @@ def test_ar(self):
ar = ARX(self.y, lags=1, volatility=GARCH(), distribution=StudentsT())
res = ar.fit(disp=DISPLAY, update_freq=5, cov_type='mle')
res.param_cov
sims = res.forecast(horizon=5, method='simulation')
assert isinstance(sims.simulations.residual_variances, np.ndarray)
assert isinstance(sims.simulations.residuals, np.ndarray)
assert isinstance(sims.simulations.values, np.ndarray)
assert isinstance(sims.simulations.variances, np.ndarray)

@pytest.mark.skipif(not HAS_MATPLOTLIB, reason='matplotlib not installed')
def test_ar_plot(self):
Expand All @@ -381,6 +386,7 @@ def test_ar_plot(self):
res.hedgehog_plot(start=500, type='mean')
res.hedgehog_plot(type='volatility')
res.hedgehog_plot(start=500, method='simulation', simulations=100)
res.hedgehog_plot(type='volatility', method='bootstrap')

def test_arch_arx(self):
self.rng.seed(12345)
Expand Down
6 changes: 3 additions & 3 deletions arch/univariate/base.py
Expand Up @@ -692,7 +692,7 @@ def forecast(self, params, horizon=1, start=None, align='origin', method='analyt
Returns
-------
forecasts : DataFrame
forecasts : ARCHModelForecast
t by h data frame containing the forecasts. The alignment of the
forecasts is controlled by `align`.
Expand Down Expand Up @@ -735,7 +735,7 @@ class _SummaryRepr(object):
"""Base class for returning summary as repr and str"""

def summary(self):
return Summary()
raise NotImplementedError("Subclasses optionally must provide.")

def __repr__(self):
out = self.__str__() + '\n'
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def forecast(self, params=None, horizon=1, start=None, align='origin', method='a
Returns
-------
forecasts : DataFrame
forecasts : ARCHModelForecast
t by h data frame containing the forecasts. The alignment of the
forecasts is controlled by `align`.
Expand Down

0 comments on commit dc3528a

Please sign in to comment.