Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RichardMM/arch into cgarch
Browse files Browse the repository at this point in the history
  • Loading branch information
Macharia committed Nov 19, 2017
2 parents 327de18 + 61a646f commit f0f65c5
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 203 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include = */arch/*
omit =
*/_version.py
*/compat/*

plugins = Cython.Coverage

[report]
# Regexes for lines to exclude from consideration
Expand All @@ -26,3 +26,4 @@ omit =
*recursions.py
*samplers.py
ignore_errors = True

15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ matrix:
- PYTHON=2.7
- NUMBA=0.24
- NUMPY=1.10
- SCIPY=0.16
- SCIPY=0.17
- MATPLOTLIB=1.5
- PANDAS=0.16
- PANDAS=0.18
- STATSMODELS_MASTER=true
- python: 2.7
env:
- PYTHON=3.4
- NUMPY=1.11
- SCIPY=0.17
- SCIPY=0.18
- NUMBA=0.27
- MATPLOTLIB=1.5
- PANDAS=0.18
Expand Down Expand Up @@ -84,17 +84,18 @@ before_install:
- conda list
- export PYTHONHASHSEED=0
- export MKL_NUM_THREADS=1
- export ARCH_CYTHON_COVERAGE=${COVERAGE}

install:
- python setup.py install
- python setup.py develop

script:
- set -e
- flake8 arch
- pytest -n 2 --cov-config .coveragerc --cov=arch arch --durations=10
- pytest --cov-config .coveragerc --cov=arch arch --durations=10
- python ci/performance.py
- if [[ ${DOCBUILD} = true ]]; then cd doc && make html && cd .. ; fi
- if [[ ${DOCBUILD} = true ]]; then python setup.py install && cd doc && make html && cd .. ; fi
- if [[ ${DOCBUILD} = true && ${TRAVIS_BRANCH} = "master" ]]; then doctr deploy doc; fi
- flake8 arch

after_success:
- if [[ ${COVERAGE} = true ]]; then coveralls --rcfile=${SRCDIR}/.coveragerc; fi
Expand Down
2 changes: 1 addition & 1 deletion arch/bootstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def apply(self, func, reps=1000, extra_kwargs=None):
base = func(*self._args, **kwargs)
try:
num_params = base.shape[0]
except:
except (IndexError, AttributeError):
num_params = 1
results = np.zeros((reps, num_params))
count = 0
Expand Down
19 changes: 17 additions & 2 deletions arch/tests/univariate/test_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
from arch.univariate.volatility import ConstantVariance, GARCH, HARCH, ARCH, \
RiskMetrics2006, EWMAVariance, EGARCH, FixedVariance
from arch.univariate.distribution import Normal, StudentsT

try:
import matplotlib.pyplot # noqa

HAS_MATPLOTLIB = True
except ImportError:
HAS_MATPLOTLIB = False
Expand Down Expand Up @@ -715,7 +717,7 @@ def test_fixed_user_parameters_new_model(self):
am = arch_model(self.y_series)
res = am.fit(disp=DISPLAY)
new_am = arch_model(self.y_series)
fixed_res = new_am .fix(res.params)
fixed_res = new_am.fix(res.params)
assert_series_equal(res.conditional_volatility,
fixed_res.conditional_volatility)
assert_series_equal(res.params, fixed_res.params)
Expand All @@ -728,7 +730,7 @@ def test_fixed_user_parameters_new_model(self):
am = arch_model(self.y_series)
res = am.fit(disp=DISPLAY, first_obs=100, last_obs=900)
new_am = arch_model(self.y_series)
fixed_res = new_am .fix(res.params, first_obs=100, last_obs=900)
fixed_res = new_am.fix(res.params, first_obs=100, last_obs=900)
assert_series_equal(res.params, fixed_res.params)
assert_equal(res.aic, fixed_res.aic)
assert_equal(res.bic, fixed_res.bic)
Expand Down Expand Up @@ -868,3 +870,16 @@ def test_constant_mean_fixed_variance(self):
res = mod.fit()
assert len(res.params) == 4
assert 'scale' not in res.params.index

def test_optimization_options(self):
am = arch_model(None)
data = am.simulate([0.0, 0.1, 0.1, 0.85], 2500)
am = arch_model(data.data)
std = am.fit(disp='off')
loose = am.fit(tol=1e-2, disp='off')
assert std.loglikelihood != loose.loglikelihood
with warnings.catch_warnings(record=True) as w:
short = am.fit(options={'maxiter': 3}, disp='off')
assert len(w) == 1
assert std.loglikelihood != short.loglikelihood
assert short.convergence_flag != 0
2 changes: 1 addition & 1 deletion arch/tests/univariate/test_volatility.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

try:
from arch.univariate import _recursions as rec
except:
except ImportError:
from arch.univariate import recursions_python as rec
from arch.univariate.volatility import GARCH, ARCH, HARCH, ConstantVariance, \
EWMAVariance, RiskMetrics2006, EGARCH, FixedVariance, CGARCH
Expand Down
22 changes: 11 additions & 11 deletions arch/unitroot/unitroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def _autolag_ols(endog, exog, startlag, maxlag, method, modargs=(), regresults=F
Parameters
----------
endog : array-like
endog : {ndarray, Series}
nobs array containing endogenous variable
exog : array-like
exog : {ndarray, DataFrame}
nobs by (startlag + maxlag) array containing lags and possibly other
variables
startlag : int
Expand Down Expand Up @@ -123,7 +123,7 @@ def _df_select_lags(y, trend, max_lags, method):
Parameters
----------
y : array
y : ndarray
The data for the lag selection exercise
trend : {'nc','c','ct','ctt'}
The trend order
Expand Down Expand Up @@ -172,7 +172,7 @@ def _estimate_df_regression(y, trend, lags):
Parameters
----------
y : array
y : ndarray
The data for the lag selection
trend : {'nc','c','ct','ctt'}
The trend order
Expand Down Expand Up @@ -384,7 +384,7 @@ class ADF(UnitRootTest):
Parameters
----------
y : array
y : {ndarray, Series}
The data to test for a unit root
lags : int, optional
The number of lags to use in the ADF regression. If omitted or None,
Expand Down Expand Up @@ -529,7 +529,7 @@ class DFGLS(UnitRootTest):
Parameters
----------
y : array
y : {ndarray, Series}
The data to test for a unit root
lags : int, optional
The number of lags to use in the ADF regression. If omitted or None,
Expand Down Expand Up @@ -692,7 +692,7 @@ class PhillipsPerron(UnitRootTest):
Parameters
----------
y : array
y : {ndarray, Series}
The data to test for a unit root
lags : int, optional
The number of lags to use in the Newey-West estimator of the long-run
Expand Down Expand Up @@ -870,7 +870,7 @@ class KPSS(UnitRootTest):
Parameters
----------
y : array
y : {ndarray, Series}
The data to test for stationarity
lags : int, optional
The number of lags to use in the Newey-West estimator of the long-run
Expand Down Expand Up @@ -963,7 +963,7 @@ class VarianceRatio(UnitRootTest):
Parameters
----------
y : array
y : {ndarray, Series}
The data to test for a random walk
lags : int
The number of periods to used in the multi-period variance, which is
Expand Down Expand Up @@ -1252,7 +1252,7 @@ def mackinnoncrit(num_unit_roots=1, regression="c", nobs=inf,
Returns
-------
crit_vals : array
crit_vals : ndarray
Three critical values corresponding to 1%, 5% and 10% cut-offs.
Notes
Expand Down Expand Up @@ -1311,7 +1311,7 @@ def kpss_crit(stat, trend='c'):
-------
pvalue : float
The interpolated p-value
crit_val : array
crit_val : ndarray
Three element array containing the 10%, 5% and 1% critical values,
in order
Expand Down
Loading

0 comments on commit f0f65c5

Please sign in to comment.