pyperfectforesight.SteadyState#
- class pyperfectforesight.SteadyState(values, params=None, exog_ss=None, vars_dyn=None, vars_exo=None)[source]#
Bases:
objectA steady-state solution with full provenance (params and exogenous values).
Wraps a numpy array of endogenous steady-state values and records the model parameters and exogenous variable levels at which they were computed. Transparently interoperates with numpy — a
SteadyStatecan be passed wherever a plainndarrayis expected (endval,ss,ss_initial, etc.) without any code changes in the callers.- params#
Model parameter values (string-keyed) used to compute this steady state.
- Type:
dict {str: float}
- exog_ss#
Exogenous variable values at which this steady state was computed.
Nonewhen the model has no exogenous variables.- Type:
ndarray of shape (n_exo,) or None
Examples
solve_steady_statereturns aSteadyStateautomatically:>>> compiled_ss = compile_steady_state_funcs(equations, vars_dyn, vars_exo) >>> ss = solve_steady_state(compiled_ss, params, exog_ss=np.array([1.05])) >>> ss.values # endogenous steady-state values array([2.972514, 40.998601]) >>> ss.exog_ss # exogenous level this steady state corresponds to array([1.05]) >>> ss.params # parameters used {'alpha': 0.36, 'beta': 0.99, 'delta': 0.025} >>> ss.vars_exo # exogenous variable names ['z']
Pass directly as
endval— callers see a plain array:>>> result = solve_perfect_foresight( ... T, params, ss_terminal, model_funcs, vars_dyn, ... exog_path=exog_path, ss_initial=ss_initial, endval=ss_terminal, ... )
You can also construct one manually to annotate a pre-computed vector:
>>> ss = SteadyState( ... my_ss_values, params={"alpha": 0.36, "beta": 0.99}, ... exog_ss=np.array([1.05]), vars_dyn=["c", "k"], vars_exo=["z"], ... )
- __init__(values, params=None, exog_ss=None, vars_dyn=None, vars_exo=None)[source]#
- Parameters:
values (array-like, shape (n_endo,)) – Endogenous variable steady-state values.
params (dict {str: float}, optional) – Model parameter values (string-keyed) used to compute this steady state. Storing these alongside the solution makes it easy to verify which calibration produced a given steady state.
exog_ss (array-like of shape (n_exo,), optional) – Exogenous variable values at which this steady state was computed. Pass
None(default) when the model has no exogenous variables or when the exogenous level is zero by convention.vars_dyn (list of str, optional) – Names of the endogenous variables in the same order as
values.vars_exo (list of str, optional) – Names of the exogenous variables in the same order as
exog_ss.
Methods
__init__(values[, params, exog_ss, ...])Attributes
- property shape#
Shape of the values array, e.g.
(n_endo,).
- property size#
Total number of elements in the values array.