FunctionalCoefficientVARResult.coefficients_at#
- FunctionalCoefficientVARResult.coefficients_at(u)[source]#
The lag stack
A_1(u), ..., A_p(u)prevailing at one state value.- Parameters:
u (
float) – A state value insidestate_range.- Return type:
- Returns:
A
(p, k, k)stack;[i - 1, r, c]is the response of variablerto lagiof variablec.- Raises:
SpecificationError – If
ulies outside the estimated range.
Example
On the tanh system the own-lag coefficient of
y1is negative at the low end of the state and positive at the high end:>>> import numpy as np >>> rng = np.random.default_rng(0) >>> y = np.zeros((250, 2)) >>> for t in range(1, 250): ... a = 0.8 * np.tanh(y[t - 1, 0]) ... y[t, 0] = a * y[t - 1, 0] + 0.5 * rng.standard_normal() ... y[t, 1] = 0.4 * y[t - 1, 1] + 0.5 * rng.standard_normal() >>> res = FunctionalCoefficientVAR(y, order=1, transition_variable="y1").fit( ... bandwidth=1.2, n_grid=21 ... ) >>> low, high = res.state_range >>> res.coefficients_at(low).shape (1, 2, 2) >>> bool(res.coefficients_at(low)[0, 0, 0] < 0.0 < res.coefficients_at(high)[0, 0, 0]) True >>> res.coefficients_at(10.0) Traceback (most recent call last): cultivars.exceptions.SpecificationError: state value 10.0 lies outside the estimated ...