Starting in version 1.0.0, HetBlocks support an arbitrary number of discrete exogenous state variables. This allows for modeling scenarios where transition probabilities (e.g., job finding or separation rates) vary over time.
To implement this, follow these requirements:
- State Space Dimensionality: Ensure your NumPy expressions support the additional dimensions. For example, if adding employment status $s$, your state space becomes 3-dimensional
(s, e, a) instead of 2-dimensional (e, a). - Chronological Order: Provide the names of your
exogenous Markov matrices in the order they occur chronologically. - Hetinput Function: Write a
hetinput function that maps your time-varying parameters (like job-finding rates) into the required Markov matrices.
Once these steps are completed, you can compute Jacobians and impulse responses with respect to these time-varying exogenous parameters.
# Example of defining a time-varying Markov matrix via hetinputs
def search_frictions(f, s):
# f is the job-finding rate, s is the separation rate
Pi_s = np.vstack(([1 - s, s], [f, 1 - f]))
return Pi_s
# Applying the decorator with exogenous matrices
@het(exogenous=['Pi_s', 'Pi_e'], policy='a', backward='Va', backward_init=household_init)
def household(Va_p, a_grid, y, r, beta, eis):
# ... implementation ...
return Va, a, c