Skip to content

Commit b9ce443

Browse files
authored
Merge pull request #637 from bashtage/rls-5.4.0
MAINT: Small updates for 5.4.0 release
2 parents 274143e + a6d6fa3 commit b9ce443

30 files changed

+190
-388
lines changed

.github/workflows/generate-documentation.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
python-version: [3.8]
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323
with:
2424
fetch-depth: 0
2525
- name: Install pandoc
26-
uses: r-lib/actions/setup-pandoc@v1
26+
uses: r-lib/actions/setup-pandoc@v2
2727
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v2
28+
uses: actions/setup-python@v3
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131
- name: Install dependencies

arch/bootstrap/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ def conf_int(
833833

834834
if not _reuse:
835835
if reuse:
836-
837836
warn = (
838837
"The conditions to reuse the previous bootstrap has "
839838
"not been satisfied. A new bootstrap will be used."

arch/bootstrap/multiple_comparison.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def included(self) -> list[Hashable]:
316316
List of column indices or names of the included models
317317
"""
318318
self._has_been_computed()
319-
included = self._pvalues.Pvalue > self.size
320-
included = list(self._pvalues.index[included])
319+
incl_loc = self._pvalues.Pvalue > self.size
320+
included = list(self._pvalues.index[incl_loc])
321321
included.sort()
322322
return included
323323

@@ -332,8 +332,8 @@ def excluded(self) -> list[Hashable]:
332332
List of column indices or names of the excluded models
333333
"""
334334
self._has_been_computed()
335-
excluded = self._pvalues.Pvalue <= self.size
336-
excluded = list(self._pvalues.index[excluded])
335+
excl_loc = self._pvalues.Pvalue <= self.size
336+
excluded = list(self._pvalues.index[excl_loc])
337337
excluded.sort()
338338
return excluded
339339

arch/covariance/kernel.py

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ def __init__(
180180
weights: ArrayLike | None = None,
181181
force_int: bool = False,
182182
):
183-
184183
self._x_orig = ensure2d(x, "x")
185184
self._x = np.asarray(self._x_orig)
186185
self._center = center

arch/data/core_cpi/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the Core CPI data used in the examples
109

arch/data/crude/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the Core CPI data used in the examples
109

arch/data/default/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the AAA and BAA rates used in the examples
109

arch/data/frenchdata/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the Fama-French factor data used in the examples
109

arch/data/nasdaq/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the NASDAQ Composite data used in the examples
109

arch/data/sp500/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the S&P 500 data used in the examples
109

arch/data/vix/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the VIX Index data used in the examples
109

arch/data/wti/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
def load() -> DataFrame:
7-
87
"""
98
Load the West Texas Intermediate crude oil price data used in the examples
109

arch/tests/covariance/test_covariance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_bartlett_auto(data: ArrayLike):
126126
assert int(nw.bandwidth) == expected_bw
127127
expected = 1.0 - np.arange(nw.bandwidth + 1) / (nw.bandwidth + 1)
128128
assert_allclose(nw.kernel_weights, expected)
129-
resid = data - data.mean(0)
129+
resid = data - np.asarray(data.mean(0))
130130
resid = np.asarray(resid)
131131
nobs = resid.shape[0]
132132
expected_cov = resid.T @ resid / nobs

arch/tests/unitroot/cointegration_data.py

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def data(request) -> Tuple[Float64Array, Float64Array]:
3232

3333
@pytest.fixture(scope="module", params=[True, False], ids=["pandas", "numpy"])
3434
def trivariate_data(request) -> Tuple[ArrayLike2D, ArrayLike2D]:
35-
3635
rs = np.random.RandomState([922019, 12882912, 192010, 10189, 109981])
3736
nobs = 1000
3837
burn = 100

arch/tests/univariate/test_moment.py

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def f(x, n):
4747
return (x**n) * exp(dist.loglikelihood(params, x, sigma2, True))
4848

4949
for n in range(6): # moments 0-5
50-
5150
# complete moments
5251
m_quad = quad(f, -inf, inf, args=(n,))[0]
5352
m_method = dist.moment(n, params)

arch/tests/utility/test_cov.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
class TestVarNW:
1313
@classmethod
1414
def setup_class(cls):
15-
1615
cls.rng = RandomState(12345)
1716
cls.cpi = log(dataset_loader(macrodata)["cpi"])
1817
cls.inflation = diff(cls.cpi)

arch/unitroot/cointegration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ def _final_statistics(self, theta: pd.Series) -> tuple[pd.Series, float, float]:
10291029
center = 0.0
10301030
tss_df = 0
10311031
if "c" in self._trend:
1032-
center = self._y.mean()
1032+
center = float(self._y.mean())
10331033
tss_df = 1
10341034
y_centered = self._y - center
10351035
ssr = resid.T @ resid

arch/unitroot/critical_values/simulation/adf_z_critical_values_simulation.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Remote clusters can be used by modifying the call to Client.
99
"""
1010
import datetime
11-
from typing import cast
11+
from typing import Literal, cast
1212

1313
from ipyparallel import Client
1414
from numpy import array, nan, ndarray, percentile, savez
@@ -29,7 +29,9 @@
2929
from numpy.random import RandomState
3030

3131

32-
def wrapper(n: int, trend: str, b: int, seed: int = 0) -> ndarray:
32+
def wrapper(
33+
n: int, trend: Literal["n", "c", "ct", "ctt"], b: int, seed: int = 0
34+
) -> ndarray:
3335
"""
3436
Wraps and blocks the main simulation so that the maximum amount of memory
3537
can be controlled on multi processor systems when executing in parallel

arch/unitroot/critical_values/simulation/engle_granger_simulation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def block(
228228

229229
shuffle(remaining_configs)
230230
if njobs == 1:
231-
for ((idx, rg), trend) in remaining_configs:
231+
for (idx, rg), trend in remaining_configs:
232232
partial_block(rg, trend=trend, idx=idx)
233233
else:
234234
Parallel(verbose=50, n_jobs=njobs)(

arch/unitroot/critical_values/simulation/phillips-ouliaris-simulation-process.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
META = {"z_a": "negative", "z_t": "negative", "p_u": "positive", "p_z": "positive"}
2121
CRITICAL_VALUES = (1, 5, 10)
2222
PLOT = False
23-
WINS: Dict[int, int] = defaultdict(lambda: 0)
23+
WINS: dict[int, int] = defaultdict(lambda: 0)
2424
# 1. Load data
2525
# 2. Compute critical values
2626

2727

2828
class PvalueResult(NamedTuple):
29-
large_p: List[float]
30-
small_p: List[float]
29+
large_p: list[float]
30+
small_p: list[float]
3131
tau_max: float
3232
tau_star: float
3333
tau_min: float
@@ -75,7 +75,7 @@ def xval(lhs: np.ndarray, rhs: np.ndarray, log: bool = True, folds: int = 5) ->
7575

7676
def estimate_cv_regression(
7777
results: pd.DataFrame, statistic: str
78-
) -> Tuple[Dict[int, List[float]], float]:
78+
) -> tuple[dict[int, list[float]], float]:
7979
# For percentiles 1, 5 and 10, regress on a constant, and powers of 1/T
8080
out = {}
8181
quantiles = np.asarray(results.index)

arch/univariate/mean.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def _check_specification(self) -> None:
546546
if isinstance(self._x, pd.Series):
547547
self._x = pd.DataFrame(self._x)
548548
elif self._x.ndim == 1:
549-
self._x = self._x[:, None]
549+
self._x = np.asarray(self._x)[:, None]
550550
if self._x.ndim != 2 or self._x.shape[0] != self._y.shape[0]:
551551
raise ValueError(
552552
"x must be nobs by n, where nobs is the same as "

arch/univariate/recursions_python.py

-6
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ def update(
766766
sigma2: Float64Array,
767767
var_bounds: Float64Array,
768768
) -> None:
769-
770769
loc = 0
771770
sigma2[t] = parameters[loc]
772771
loc += 1
@@ -814,7 +813,6 @@ def update(
814813
sigma2: Float64Array,
815814
var_bounds: Float64Array,
816815
) -> None:
817-
818816
backcast = self.backcast
819817

820818
sigma2[t] = parameters[0]
@@ -854,7 +852,6 @@ def update(
854852
sigma2: Float64Array,
855853
var_bounds: Float64Array,
856854
) -> None:
857-
858855
sigma2[t] = self.params[0]
859856
if t == 0:
860857
sigma2[t] += self.backcast
@@ -896,7 +893,6 @@ def update_weights(self, theta: float) -> None:
896893
def initialize_update(
897894
self, parameters: Float64Array, backcast: float | Float64Array, nobs: int
898895
) -> None:
899-
900896
self.update_weights(parameters[2 + self.asym])
901897
alpha = parameters[1]
902898
if self.asym:
@@ -919,7 +915,6 @@ def update(
919915
sigma2: Float64Array,
920916
var_bounds: Float64Array,
921917
) -> None:
922-
923918
omega = parameters[0]
924919
if t > 0:
925920
self.resids2[t - 1] = resids[t - 1] * resids[t - 1]
@@ -1009,7 +1004,6 @@ def update(
10091004
sigma2: Float64Array,
10101005
var_bounds: Float64Array,
10111006
) -> None:
1012-
10131007
w = self.combination_weights
10141008
mus = self.smoothing_parameters
10151009
if t == 0:

arch/univariate/volatility.py

-7
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,6 @@ def _analytic_forecast(
12341234
start: int,
12351235
horizon: int,
12361236
) -> VarianceForecast:
1237-
12381237
sigma2, forecasts = self._one_step_forecast(
12391238
parameters, resids, backcast, var_bounds, horizon, start
12401239
)
@@ -1298,7 +1297,6 @@ def _simulate_paths(
12981297
scaled_shock: Float64Array,
12991298
asym_scaled_shock: Float64Array,
13001299
) -> tuple[Float64Array, Float64Array, Float64Array]:
1301-
13021300
power = self.power
13031301
p, o, q = self.p, self.o, self.q
13041302
omega = parameters[0]
@@ -1346,7 +1344,6 @@ def _simulation_forecast(
13461344
simulations: int,
13471345
rng: RNGType,
13481346
) -> VarianceForecast:
1349-
13501347
sigma2, forecasts = self._one_step_forecast(
13511348
parameters, resids, backcast, var_bounds, horizon, start
13521349
)
@@ -2344,7 +2341,6 @@ def compute_variance(
23442341
backcast: float | Float64Array,
23452342
var_bounds: Float64Array,
23462343
) -> Float64Array:
2347-
23482344
nobs = resids.shape[0]
23492345
kmax = self.kmax
23502346
w = self._ewma_combination_weights()
@@ -2698,7 +2694,6 @@ def _analytic_forecast(
26982694
start: int,
26992695
horizon: int,
27002696
) -> VarianceForecast:
2701-
27022697
_, forecasts = self._one_step_forecast(
27032698
parameters, resids, backcast, var_bounds, horizon, start
27042699
)
@@ -3035,7 +3030,6 @@ def bounds(self, resids: Float64Array) -> list[tuple[float, float]]:
30353030
return bounds
30363031

30373032
def constraints(self) -> tuple[Float64Array, Float64Array]:
3038-
30393033
# omega > 0 <- 1
30403034
# 0 <= d <= 1 <- 2
30413035
# 0 <= phi <= (1 - d) / 2 <- 2
@@ -3600,7 +3594,6 @@ def _simulate_paths(
36003594
shock: Float64Array,
36013595
abs_shock: Float64Array,
36023596
) -> tuple[Float64Array, Float64Array, Float64Array]:
3603-
36043597
if self._est_delta:
36053598
delta = parameters[-1]
36063599
else:

ci/azure/azure_template_posix.yml

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
MATPLOTLIB: 3.3.0
4242
NUMPY: 1.19.0
4343
PANDAS: 1.1.0
44+
python_311:
45+
python.version: '3.11'
4446
python_310:
4547
python.version: '3.10'
4648
test.install: true
@@ -61,6 +63,7 @@ jobs:
6163
NUMPY: 1.21.0
6264
USE_NUMBA: false
6365
MATPLOTLIB: 3.3.0
66+
PANDAS: 1.5.0
6467
PYTEST_PATTERN: "(slow or not slow)"
6568
python_39_numpy_118:
6669
python.version: '3.9'

ci/azure/azure_template_windows.yml

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
python.version: '3.9'
2323
python310_win_latest:
2424
python.version: '3.10'
25+
# Disabled since numba not available
26+
# python311_win_latest:
27+
# python.version: '3.11'
2528
maxParallel: 10
2629

2730
steps:

examples/univariate_using_fixed_variance.ipynb

+21-217
Large diffs are not rendered by default.

examples/univariate_volatility_modeling.ipynb

+108-101
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)