gcubed.linearisation.model_solver
This module contains the ModelSolver
class.
It is used to find a point that solves the equations in the model using a numeric search algorithm.
This is experimental functionality that can be used to adjust the point around which the model is linearised.
Overview
Note that this class is not used to find the SolvedModel
.
This model solver just finds a point (a value for each variable in the model) that simultaneously solves the nonlinear equations in the model, taking as given the values for the vectors:
- yxr
- yjr
- exz
- exo
If a solution can be found, it will be values for the following vectors:
- x1r
- j1r
- zer
- z1r
The process is:
- Populate all vectors using database values for the linearisation year.
- Select just those model equations that involve a LHS variable on the RHS.
- Solve for roots of those equations using the least squares algorithm.
- Check that the roots are indeed roots (least squares could converge to values that minimise the sum of squares while not producing roots) by ensuring that the RHS values that are the proposed solution to the equations are the LHS values for those RHS values.
Arguments
model
: The model to linearise.
linearisation_year
: The year to linearise around.
use_neutral_real_interest_rate
: If True
, the neutral real interest rate will be used, otherwise
the real interest rates will be the value from the database. This parameter defaults to True
.
Returns the original values for the given vector name.
Returns the solution values for the given vector name.
Exceptions
Raises a runtime error if no solution has been found.
Arguments
variable
: The vector and index pair that identifies the variable.
Returns
The return value, equal to the index of the variable in the vector of variables that we are adjusting to find a model solution.