gcubed.linearisation.stable_manifold
This module contains the StableManifold
class.
It provides access to the state space form and the linear model and it provides access to the matrices that can be used to quickly project the values for the model's state variables.
Overview
The algebra embodied in this class follows the second page of https://www.msgpl.com.au/Manuals2021/GGGv20JManual/softwaremanual/algorithm.pdf
For the details, see https://www.rba.gov.au/publications/rdp/1987/pdf/rdp8706.pdf
This script produces rules for the evolution of model variables:
Using the vector names defined in the SYM processor:
The rule for the costate or jump variables has the form:
$$J_t = H_1 X1_t + H_1 EXO_t + \text{a linear function of future EXO variables}$$
The rule for the ZE vector of special endogenous variables has the form:
$$ZE_t = \mu_1 X1_t + \mu_4 EXO_t + \text{a linear function of future EXO variables}$$
The rule for the state variables is:
$$X1_t = \tau_1 X1_{t-1} + \tau_2 J_{t-1} + \tau_4 EXO_{t} + \tau_7 EXO_{t-1}$$
The rule for the endogenous variables, Z1, is just the equation obtained when forming the SSF:
$$Z1_t = z1l/yxr_{ssf} X1_{t-1} + z1l/yjr_{ssf} J1_{t-1} + z1l/exz_{ssf} ZE_{t+1} + z1l/exo_{ssf} EXO_{t}$$
These rules are embodied in the coefficient matrices in each of them.
Iteration to convergence algorithm for the stable manifold:
Convergence criteria:
- If there are no jump variables, just do a single iteration and stop.
Report progress for each iteration:
- Check the average absolute error in the jump matrix, h1t
- Check the average absolute error in the jump matrix, h2t Cumulative errors are the average absolute values of the change in the elements in the matrix, considering mean(abs(H1tL - H1t)) and mean(abs(H2tL - H2t)).
Convergence has been reached if both of these average absolute errors are less than the tolerance specified in the model configuration.
Iterations update the H1 and H2 coefficient matrices until they stabilise.
Interim calculations in the iteration process produce the other coefficient matrices needed for the other rules describing the path of model variables X1 and ZE.
Constructor
The stable manifold is solved for using the coefficient matrices in the state-space form of the model.
Arguments
state_space_form: The state-space form of the model being used. This provides access to all information about the model including the coefficient matrices that define the state-space form itself.
The state space form of the model, based on algebraic manipulation of the linear approximation to the original model.
The linear model that is used to generate the state space form.
Overview
Runs the iteration process, checking convergence criteria each time until convergence is reached or the maximum number of iterations has occurred.
A matrix that is used when generating projections. See the model solution documentation equation 31.
Note that in the Ox implementation of G-Cubed, the diagonal elements are slightly wrong, being left as 1.0 exactly when they should be slightly perturbed by the impact of the SSF matrix. Python does not have this problem.
A matrix that is used when generating projections. See the model solution documentation equation 32.
A matrix that is used when generating projections. See the model solution documentation equation 33.
A matrix that is used when generating projections. See the model solution documentation equation 34.
A matrix that is used when generating projections. See the model solution documentation equation 52
A matrix that is used when generating projections. See the model solution documentation equation 62
The matrix relating J1 (costate variables) to X1 (state variables) in the equation used to project costate variables. See the model solution documentation equation 63.
The matrix relating J1 (costate variables) to EXO (exogenous variables) in the equation used to project costate variables. See the model solution documentation equation 64.
The matrix relating ZE (expected endogenous variables) to X1 (state variables) in the equation that can be used to project state variables. See the model solution documentation equation 71.
The matrix relating ze (expected endogenous variables) to exo (exogenous variables) in the equation that can be used to project state variables. See the model solution documentation equation 72.
The matrix relating time t expectations of endogenous variables in t+1 to state in period t. See the model solution documentation equation 77.
The matrix relating time t expectations of endogenous variables in t+1 to exogenous variables in period t. See the model solution documentation equation 78.
The matrix relating endogenous state variables (x1) s_{t+1} to previous state variables (x1) s_{t} See the model solution documentation equation 75.
The matrix relating state variables (x1) s_{t+1} to previous exogenous variables (exo) x_{t} See the model solution documentation equation 75.
A dataframe representation of H1 that labels the rows and columns of H1 with the relevant variables.
A dataframe representation of H2 that labels the rows and columns of H2 with the relevant variables.
A dataframe representation of mu1 that labels the rows and columns of mu1 with the relevant variables.
A dataframe representation of mu2 that labels the rows and columns of mu2 with the relevant variables.
A dataframe representation of M1 that labels the rows and columns of M1 with the relevant variables.
A dataframe representation of M2 that labels the rows and columns of M2 with the relevant variables.
A dataframe representation of Znew that labels the rows and columns of Znew with the relevant variables.
A matrix that is exposed as part of unit testing the Python implementation. th6t in Ox
The eigenvalues of the Anew matrix, returned as a column vector of complex numbers.
Overview
Determine how many eigen values are on the unit circle (implying unit roots in state variables) and how many are outside of the unit circle (impying instability in the model).
True if the model has converged to a solution (stable or otherwise) and False if the model has not converged.