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.

class StableManifold(gcubed.base.Base):

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:

  1. If there are no jump variables, just do a single iteration and stop.

Report progress for each iteration:

  1. Check the average absolute error in the jump matrix, h1t
  2. 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.

StableManifold( state_space_form: gcubed.linearisation.state_space_form.StateSpaceForm)

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.

The model for which the stable manifold is being sought.

def solve(self):

Overview

Runs the iteration process, checking convergence criteria each time until convergence is reached or the maximum number of iterations has occurred.

Gamma_rT: numpy.ndarray

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.

psi_rs: numpy.ndarray

A matrix that is used when generating projections. See the model solution documentation equation 32.

psi_rj: numpy.ndarray

A matrix that is used when generating projections. See the model solution documentation equation 33.

psi_rx: numpy.ndarray

A matrix that is used when generating projections. See the model solution documentation equation 34.

Gamma_jT: numpy.ndarray

A matrix that is used when generating projections. See equation 37.

Gamma_st: numpy.ndarray

A matrix that is used when generating projections. See the model solution documentation equation 52

Gamma_jt: numpy.ndarray

A matrix that is used when generating projections. See the model solution documentation equation 62

H1: numpy.ndarray

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.

H2: numpy.ndarray

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.

M1: numpy.ndarray

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.

M2: numpy.ndarray

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.

mu1: numpy.ndarray

The matrix relating time t expectations of endogenous variables in t+1 to state in period t. See the model solution documentation equation 77.

mu2: numpy.ndarray

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.

M1_lead: numpy.ndarray

The 1 period lead (t+1) for M1t

Anew: numpy.ndarray

The matrix relating endogenous state variables (x1) s_{t+1} to previous state variables (x1) s_{t} See the model solution documentation equation 75.

Znew: numpy.ndarray

The matrix relating state variables (x1) s_{t+1} to previous exogenous variables (exo) x_{t} See the model solution documentation equation 75.

H1_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of H1 that labels the rows and columns of H1 with the relevant variables.

H2_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of H2 that labels the rows and columns of H2 with the relevant variables.

mu1_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of mu1 that labels the rows and columns of mu1 with the relevant variables.

mu2_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of mu2 that labels the rows and columns of mu2 with the relevant variables.

M1_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of M1 that labels the rows and columns of M1 with the relevant variables.

M2_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of M2 that labels the rows and columns of M2 with the relevant variables.

Anew_as_dataframe: pandas.core.frame.DataFrame
Znew_as_dataframe: pandas.core.frame.DataFrame

A dataframe representation of Znew that labels the rows and columns of Znew with the relevant variables.

tau_sst

A matrix that is exposed as part of unit testing the Python implementation.

tau_sjt

A matrix that is exposed as part of unit testing the Python implementation.

th2t in Ox

tau_sxt

A matrix that is exposed as part of unit testing the Python implementation.

common_factor

A matrix that is exposed as part of unit testing the Python implementation. th6t in Ox

eigenvalues: numpy.ndarray

The eigenvalues of the Anew matrix, returned as a column vector of complex numbers.

def analyse_eigenvalues(self):

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).

unit_roots: int

The number of unit roots in the model.

roots_outside_unit_circle: int

The number of roots outside the unit circle.

solution_is_stable: bool

True if the model is stable and False otherwise.

converged: bool

True if the model has converged to a solution (stable or otherwise) and False if the model has not converged.

average_H1_change: float

Returns the average change in H1.

average_H2_change: float

Returns the average change in H2