diff --git a/.travis.yml b/.travis.yml index b7146cd8da..17c7a60b50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,7 +93,7 @@ script: - set -e - 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 diff --git a/arch/unitroot/unitroot.py b/arch/unitroot/unitroot.py index c5bb8e3715..7b2a7ea76a 100644 --- a/arch/unitroot/unitroot.py +++ b/arch/unitroot/unitroot.py @@ -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 @@ -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 @@ -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 @@ -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, @@ -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, @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/arch/univariate/base.py b/arch/univariate/base.py index 0a1f58850d..fe13e3a47b 100644 --- a/arch/univariate/base.py +++ b/arch/univariate/base.py @@ -37,7 +37,7 @@ def _callback(*args): Parameters ---------- - parameters : np.ndarray + parameters : : ndarray Parameter value (not used by function) Notes @@ -60,9 +60,9 @@ def constraint(a, b): Parameters ---------- - a : np.ndarray + a : ndarray Parameter loadings - b : np.ndarray + b : ndarray Constraint bounds Returns @@ -113,7 +113,7 @@ def implicit_constant(x): Parameters ---------- - x : np.ndarray + x : ndarray Array to be tested Returns @@ -178,9 +178,9 @@ def constraints(self): Returns ------- - a : np.ndarray + a : ndarray Number of constraints by number of parameters loading array - b : np.ndarray + b : ndarray Number of constraints array of lower bounds Notes @@ -387,7 +387,7 @@ def fit(self, update_freq=1, disp='final', starting_values=None, disp : str Either 'final' to print optimization result or 'off' to display nothing - starting_values : np.ndarray, optional + starting_values : ndarray, optional Array of starting values to use. If not provided, starting values are constructed by the model components. cov_type : str, optional @@ -572,7 +572,7 @@ def starting_values(self): Returns ------- - sv : np.ndarray + sv : ndarray Starting values """ params = np.asarray(self._fit_no_arch_normal_errors().params) @@ -599,16 +599,16 @@ def resids(self, params, y=None, regressors=None): Parameters ---------- - params : np.ndarray + params : ndarray Model parameters - y : np.ndarray, optional + y : ndarray, optional Alternative values to use when computing model residuals - regressors : np.ndarray, optional + regressors : ndarray, optional Alternative regressor values to use when computing model residuals Returns ------- - resids : np.ndarray + resids : ndarray Model residuals """ raise NotImplementedError('Subclasses must implement') @@ -619,7 +619,7 @@ def compute_param_cov(self, params, backcast=None, robust=True): Parameters ---------- - params : np.ndarray + params : ndarray Model parameters backcast : float Value to use for pre-sample observations @@ -660,7 +660,7 @@ def forecast(self, params, horizon=1, start=None, align='origin', method='analyt Parameters ---------- - params : np.ndarray, optional + params : ndarray, optional Alternative parameters to use. If not provided, the parameters estimated when fitting the model are used. Must be identical in shape to the parameters computed by fitting the model. @@ -751,12 +751,12 @@ class ARCHModelFixedResult(_SummaryRepr): Parameters ---------- - params : np.ndarray + params : ndarray Estimated parameters - resid : np.ndarray + resid : ndarray Residuals from model. Residuals have same shape as original data and contain nan-values in locations not used in estimation - volatility : np.ndarray + volatility : ndarray Conditional volatility from model dep_var: Series Dependent variable @@ -786,7 +786,7 @@ class ARCHModelFixedResult(_SummaryRepr): Akaike information criteria bic : float Schwarz/Bayes information criteria - conditional_volatility : {np.ndarray, Series} + conditional_volatility : {ndarray, Series} nobs element array containing the conditional volatility (square root of conditional variance). The values are aligned with the input data so that the value in the t-th position is the variance of t-th error, @@ -797,7 +797,7 @@ class ARCHModelFixedResult(_SummaryRepr): Number of observations used in the estimation num_params : int Number of parameters in the model - resid : {np.ndarray, Series} + resid : {ndarray, Series} nobs element array containing model residuals model : ARCHModel Model instance used to produce the fit @@ -1056,7 +1056,7 @@ def forecast(self, params=None, horizon=1, start=None, align='origin', method='a Parameters ---------- - params : np.ndarray, optional + params : ndarray, optional Alternative parameters to use. If not provided, the parameters estimated when fitting the model are used. Must be identical in shape to the parameters computed by fitting the model. @@ -1126,7 +1126,7 @@ def hedgehog_plot(self, params=None, horizon=10, step=10, start=None, Parameters ---------- - params : {np.ndarray, Series} + params : {ndarray, Series} Alternative parameters to use. If not provided, the parameters computed by fitting the model are used. Must be 1-d and identical in shape to the parameters computed by fitting the model. @@ -1225,18 +1225,18 @@ class ARCHModelResult(ARCHModelFixedResult): Parameters ---------- - params : np.ndarray + params : ndarray Estimated parameters - param_cov : {np.ndarray, None} + param_cov : {ndarray, None} Estimated variance-covariance matrix of params. If none, calls method to compute variance from model when parameter covariance is first used from result r2 : float Model R-squared - resid : np.ndarray + resid : ndarray Residuals from model. Residuals have same shape as original data and contain nan-values in locations not used in estimation - volatility : np.ndarray + volatility : ndarray Conditional volatility from model cov_type : str String describing the covariance estimator used @@ -1273,7 +1273,7 @@ class ARCHModelResult(ARCHModelFixedResult): Akaike information criteria bic : float Schwarz/Bayes information criteria - conditional_volatility : {np.ndarray, Series} + conditional_volatility : {ndarray, Series} nobs element array containing the conditional volatility (square root of conditional variance). The values are aligned with the input data so that the value in the t-th position is the variance of t-th error, @@ -1296,7 +1296,7 @@ class ARCHModelResult(ARCHModelFixedResult): Array of parameter standard errors pvalues : Series Array of p-values for the t-statistics - resid : {np.ndarray, Series} + resid : {ndarray, Series} nobs element array containing model residuals model : ARCHModel Model instance used to produce the fit @@ -1324,7 +1324,7 @@ def conf_int(self, alpha=0.05): Returns ------- - ci : np.ndarray + ci : ndarray Array where the ith row contains the confidence interval for the ith parameter """ @@ -1598,14 +1598,14 @@ class ARCHModelForecast(object): Parameters ---------- - index : {list, np.ndarray} - mean : np.ndarray - variance : np.ndarray - residual_variance : np.ndarray - simulated_paths : np.ndarray, optional - simulated_variances : np.ndarray, optional - simulated_residual_variances : np.ndarray, optional - simulated_residuals : np.ndarray, optional + index : {list, ndarray} + mean : ndarray + variance : ndarray + residual_variance : ndarray + simulated_paths : ndarray, optional + simulated_variances : ndarray, optional + simulated_residual_variances : ndarray, optional + simulated_residuals : ndarray, optional align : {'origin', 'target'} Attributes diff --git a/arch/univariate/mean.py b/arch/univariate/mean.py index 466274d3e1..077e122706 100644 --- a/arch/univariate/mean.py +++ b/arch/univariate/mean.py @@ -10,6 +10,7 @@ import numpy as np from numpy import zeros, empty, ones, isscalar, log from pandas import DataFrame +import pandas as pd from scipy.optimize import OptimizeResult from statsmodels.tools.decorators import cache_readonly from statsmodels.tsa.tsatools import lagmat @@ -41,11 +42,11 @@ def _ar_forecast(y, horizon, start_index, constant, arp): Parameters ---------- - y : np.ndarray + y : ndarray horizon : int start_index : int constant : float - arp : np.ndarray + arp : ndarray Returns ------- @@ -85,9 +86,9 @@ class HARX(ARCHModel): Parameters ---------- - y : {np.ndarray, Series} + y : {ndarray, Series} nobs element vector containing the dependent variable - x : {np.ndarrayor, DataFrame}, optional + x : {ndarrayor, DataFrame}, optional nobs by k element array containing exogenous regressors lags : {scalar, array}, optional Description of lag structure of the HAR. Scalar included all lags @@ -259,7 +260,7 @@ def simulate(self, params, nobs, burn=500, initial_value=None, x=None, Parameters ---------- - params : np.ndarray + params : ndarray Parameters to use when simulating the model. Parameter order is [mean volatility distribution] where the parameters of the mean model are ordered [constant lag[0] lag[1] ... lag[p] ex[0] ... @@ -271,13 +272,13 @@ def simulate(self, params, nobs, burn=500, initial_value=None, x=None, burn : int, optional Number of values to simulate to initialize the model and remove dependence on initial values. - initial_value : {np.ndarray, float}, optional + initial_value : {ndarray, float}, optional Either a scalar value or `max(lags)` array set of initial values to use when initializing the model. If omitted, 0.0 is used. x : array, optional nobs + burn by k array of exogenous variables to include in the simulation. - initial_value_vol : {np.ndarray, float}, optional + initial_value_vol : {ndarray, float}, optional An array or scalar to use when initializing the volatility process. Returns @@ -705,7 +706,7 @@ class ConstantMean(HARX): Parameters ---------- - y : array or Series + y : {ndarray, Series} nobs element vector containing the dependent variable hold_back : int Number of observations at the start of the sample to exclude when @@ -813,7 +814,7 @@ class ZeroMean(HARX): Parameters ---------- - y : array or Series + y : {ndarray, Series} nobs element vector containing the dependent variable hold_back : int Number of observations at the start of the sample to exclude when @@ -927,9 +928,9 @@ class ARX(HARX): Parameters ---------- - y : array or Series + y : {ndarray, Series} nobs element vector containing the dependent variable - x : array or DataFrame, optional + x : {ndarray, DataFrame}, optional nobs by k element array containing exogenous regressors lags : scalar, 1-d array, optional Description of lag structure of the HAR. Scalar included all lags @@ -1027,9 +1028,9 @@ class LS(HARX): Parameters ---------- - y : array or Series + y : {ndarray, Series} nobs element vector containing the dependent variable - x : array or DataFrame, optional + y : {ndarray, DataFrame}, optional nobs by k element array containing exogenous regressors constant : bool, optional Flag whether the model should include a constant @@ -1073,7 +1074,7 @@ def arch_model(y, x=None, mean='Constant', lags=0, vol='Garch', p=1, o=0, q=1, Parameters ---------- - y : {np.ndarray, Series, None} + y : {ndarray, Series, None} The dependent variable x : {np.array, DataFrame}, optional Exogenous regressors. Ignored if model does not permit exogenous diff --git a/arch/univariate/volatility.py b/arch/univariate/volatility.py index 2cefdaaa1f..6c639c2913 100644 --- a/arch/univariate/volatility.py +++ b/arch/univariate/volatility.py @@ -1922,7 +1922,7 @@ class FixedVariance(VolatilityProcess): Parameters ---------- - variance : {array, pd.Series} + variance : {array, Series} Array containing the variances to use. Shoule have the same shape as the data used in the model. unit_scale : bool, optional diff --git a/arch/utility/array.py b/arch/utility/array.py index a6f410e396..75e0d61f66 100644 --- a/arch/utility/array.py +++ b/arch/utility/array.py @@ -122,7 +122,7 @@ def date_to_index(date, date_index): ---------- date : string, datetime or datetime64 Date to use when returning the index - date_index : array + date_index : {list, ndarray} Index data containing datetime64 values Returns diff --git a/arch/utility/cov.py b/arch/utility/cov.py index 4b5f45228d..9a47951946 100644 --- a/arch/utility/cov.py +++ b/arch/utility/cov.py @@ -7,7 +7,7 @@ def cov_nw(y, lags=0, demean=True, axis=0, ddof=0): Parameters ---------- - y : array + y : ndarray Values to use when computing the Newey-West covariance estimator, either 1-d or 2-d. When y is 2d, default behavior is to treat columns as variables and rows as observations. @@ -23,7 +23,7 @@ def cov_nw(y, lags=0, demean=True, axis=0, ddof=0): Returns ------- - cov : array + cov : ndarray The estimated covariance """ diff --git a/arch/utility/timeseries.py b/arch/utility/timeseries.py index 9b8b256a3e..f853077d9b 100644 --- a/arch/utility/timeseries.py +++ b/arch/utility/timeseries.py @@ -43,7 +43,7 @@ def add_trend(x=None, trend="c", prepend=False, nobs=None, Parameters ---------- - x : array-like or None + x : {ndarray, DataFrame} Original array of data. If None, then nobs must be a positive integer trend : str {"c","t","ct","ctt"} "c" add constant only diff --git a/doc/source/conf.py b/doc/source/conf.py index 24a70ee775..bd4c9ae7fd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -39,6 +39,7 @@ 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.napoleon', + 'sphinx.ext.intersphinx', 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive' ] @@ -290,11 +291,13 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'statsmodels': ('http://www.statsmodels.org/dev/', None), - 'matplotlib': ('http://matplotlib.org/', None), - 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), - 'python': ('http://docs.python.org/3', None), - 'numpy': ('http://docs.scipy.org/doc/numpy', None), - 'pandas': ('http://pandas.pydata.org/pandas-docs/stable/', None) + 'matplotlib': ('https://matplotlib.org', None), + 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), + 'python': ('https://docs.python.org/3', None), + 'numpy': ('https://docs.scipy.org/doc/numpy', None), + 'np': ('https://docs.scipy.org/doc/numpy', None), + 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), + 'pd': ('https://pandas.pydata.org/pandas-docs/stable/', None), } extlinks = {'issue': ('https://github.com/bashtage/arch/issues/%s', 'GH')}