gcubed.model_parameters.parameters

This module contains the classes that are responsible for loading and calibrating model parameters.

class Parameters(gcubed.base.Base):

Overview

This is the base class for all Parameter calibration classes.

It manages loading, calculation and provision of model parameters.

Parameters are stored as a dictionary of data frames, keyed by parameter name and with the dataframe being the grid of parameter values associated with that parameter name, as specified in the file of user-specified parameter values.

Note that the keys in this dictionary match the parameter names in the list of parameter names read in from the varmap file generated by SYM processing. When populating the vector of parameter values, each dataframe in parameters needs to be vectorised by stacking the transposed rows of the dataframe.

Subclasses add or modify various parameter calibration methods. Each model version and build combination has its own associated subclass of the Parameters class.

Setting up the model's parameter calibration class

The python directory for the model version and build must contain a file called parameters_<VERSION>_<BUILD>.py. <VERSION> and <BUILD> are the version and build of the model respectively.

That file must contain a class called Parameters<VERSION>BUILD>.

The custom parameter class must be a subclass of the gcubed.model_parameters.parameters.Parameters class.

Parameters(database: gcubed.data.database.Database, base_year: int)

Overview

Base class for parameter loading and calibration.

Arguments

database: The model database.

base_year: The base year to use for the database when doing parameter calibration.

def model_has_parameter(self, parameter_name: str) -> bool:

Overview

Check if the model has a parameter with the given name.

Arguments

parameter_name: The name of the parameter to check for.

Returns

True if the model has a parameter with the given name and False otherwise.

def validate(self):

Run from subclass initialisation after the subclass initialisation has completed. Raise an exception if the parameter setting information is invalid

calibration_year: int
non_sym_parameter_names

Returns a tuple containing the names of parameters that are assigned values in the user-set parameter values by region but where those parameters are not defined in the SYM model definition.

all_parameters: dict[str, pandas.core.frame.DataFrame]

A dictionary of all parameters, keyed by parameter name. Each parameter is represented by a dataframe of parameter values.

def parameter(self, parameter_name: str) -> pandas.core.frame.DataFrame:

Arguments

parameter_name: The name of the parameter to return.

Returns

The value of the named parameter.

Exceptions

Raise an exception if the parameter is not available.

def has_parameter(self, parameter_name: str) -> bool:

Arguments

parameter_name: The name of the parameter to return.

Returns

True if the parameter is available and False otherwise.

parameter_values: pandas.core.frame.DataFrame

The vectorised parameter values in SYM model order as a data frame indexed by the full parameter name.

parameter_values_vector: numpy.ndarray

Used when evaluating the model equations for linearisation.

discrate: pandas.core.frame.DataFrame

Discount rates by region

TCAX: pandas.core.frame.DataFrame

The TCAX parameter values are 1 for regions where the TCAX (unit tax on carbon) is to be used for the region and 0 if it is not to be used for the region. This feeds into the stable manifold calculation.

EMZT: pandas.core.frame.DataFrame

The EMZT parameter values are 1 for regions where the EMZT (carbon emissions) is to be used for the region and 0 if it is not to be used for the region. This feeds into the stable manifold calculation.

def set_carcoef_parameters(self):

Sector output carbon emissions coefficient calibration. Obsolete from model build 180 onwards.

def set_a_matrix_parameters(self):

Overview

Calibrate parameters that are used to determine the way regions accumulate their holdings of financial assets in each regional currency.

See the documentation of the calibration of these parameters for additional information.

def set_investment_parameters(self):

Overview

base_jk parameter - base investment (J) divided by capital (K) for the calibration year for each region/standard industry combination:

This corresponds to a matrix formed from elements in each row of data provided in the calibration year database.

def set_cd_parameters(self):

Overview

cd_* parameters are all switches to flip between the Constant Elasticity of Substitution (CES) production function and the Cobb-Douglas production function.

A value of 1 means Cobb-Douglas and 0 means CES.

These parameters are all inferred from the supplied elasticities of substitution. If the elasticities of substitution are close enough to 1 then the elasticity of substitution is effectively set to 1 by working with the Cobb-Douglas function.

def set_delta_parameters(self):

Overview

TODO: Document the definitions of each of these parameters and the economics behind their calibration.

delta_dom delta_e delta_m delta_ff delta_mH - C: consumption column of IO table delta_mR - I: investment column of IO table delta_mG - G: government column of IO table delta_eH - C: consumption column of IO table - energy sectors delta_eR - I: investment column of IO table - energy sectors delta_eG - G: government column of IO table - energy sectors delta_oG - C: consumption column of IO table delta_oH - I: investment column of IO table delta_oR - G: government column of IO table

def set_weight_parameters(self):

prid_weight - Domestic production for each sector in a region. as a fraction of total domestic production across all sectors for that region.

prim_weight - DF imports by good type divided by the value of imports in total at the destination.

prix_weight - Exports by non-electricity generating sector as a fraction of region total exports where exports are measured as a percentage of real GDP for the region.

eer_weight - trade weights, NEER (trade-weighted exch rate, FC/domestic) and REER (trade-weighted real exch rate, FC/domestic)

All of these parameters are set using data from the calibration year.

def set_other_parameters(self):

Overview

transgdp

Transfers per unit of GDP. Set to the ratio of transfers to GDP in the calibration year.

mongdp

The coefficient on money in the equation for total wealth. Set to zero in the default implementation of the parameter calibration system.

makeinv

This is the matrix that describes the fraction of output of each good produced by each sector. There is one such matrix for each region. It maps between sectors and goods for that region. In the default parameter calibration system, this matrix is an Identity matrix so each sector only produced one good.

This matrix is vectorised for the region and the makeinv matrix used in the model equations has a column for each region, with that column being the vectorised matrix.

The elements in column j are for region j.

The elements in the rows corresponding to sector i and to good i are set to 1.0. The elements in the other rows are set to 0.0.

def set_emissions_parameters(self):

This function is intended for gcubed module internal use. It is exposed only for documentation purposes.

Set the values of the emissions parameters. carcoef - carbon emissions coefficients btucoef - emissions coefficients, energy gwhcoef - gigawatt hours electricity per annum

def insert_parameter( self, parameter_name: str, parameter_value: pandas.core.frame.DataFrame):

Overview

Saves the calibrated parameter values in two forms:

  1. the vectorised set of values for a parameter are stored in the full parameter values vector in the correct elements.
  2. The dataframe of parameter values, with columns corresponding to regions, are stored in a dictionary of all parameters.

The dataframes of parameter values can be helpful when debugging parameter calibration.

Arguments

parameter_name: the name of the parameter. This must be one of the parameters named in the SYM model definition.

parameter_value: the value of the parameter. This must be a dataframe. The dataframe must have the same number of elements (across rows and columns) as the parameter does in the SYM model definition.

Exceptions

Raises an exception if the parameter value is not a dataframe.