pyperfectforesight.residual#

pyperfectforesight.residual(X, params, all_syms, residual_funcs, vars_dyn, dynamic_eqs, vars_exo=None, exog_path=None, endo_lags=None, exo_lags=None)[source]#

Evaluate residuals of the dynamic equations

Parameters:#

Xndarray

State path (T x n_endo)

paramsdict

Parameter values

all_symslist

All symbols in the equations

residual_funcslist

Compiled residual functions

vars_dynlist

List of endogenous variable names

dynamic_eqslist

List of dynamic equations

vars_exolist, optional

List of exogenous variable names

exog_pathndarray, optional

Exogenous variable path (T x n_exo)

endo_lagslist of int, optional

Sorted list of integer lags that appear for endogenous variables. If None (or if exo_lags is also None), derived automatically from all_syms via _compute_lag_sets. Pass the precomputed value from model_funcs[‘endo_lags’] to avoid rescanning all_syms on every call.

exo_lagslist of int, optional

Sorted list of integer lags that appear for exogenous variables. Same semantics as endo_lags. Out-of-range indices are clamped to [0, T-1] (boundary replication).

Returns:#

ndarray : Flattened residual vector of length (T-1)*neq