modelgrab module

Created on Mon Jun 10 21:11:08 2019

@author: hanseni

modules to grab models with different specifications and make them ModelFlow conforme

GrabWbModel will take a eviews model and transform it to Business logic

  • Create a normalized model, add dampning for the stocastic equations

  • Add add-factors to the stocastic equations

  • Generate BL for a model which calculates add-factors so a solution will match teh existing values

  • Generate BL for the model

-grap data from excel sheet

  • Make model instance for model and add-factor model

  • Run the model, check that the results match.

For debuggging valuesthe last part checs value in the order, in which they are calculated, and then displays the input to off mark equations

class modelgrab.GrapWbModel(frml: str = '', data: str = '', des: any = '', scalars: str = '', modelname: str = 'No Name', start: int = 2017, end: int = 2040, country_trans: any = <function GrapWbModel.<lambda>>, country_df_trans: any = <function GrapWbModel.<lambda>>, from_wf2: bool = False, make_fitted: bool = False, fit_start: int = 2000, fit_end: int = 2100, do_add_factor_calc: bool = True, mfmsa: str = '')[source]

Bases: object

This class takes a world bank model specification, variable data and variable description and transform it to ModelFlow business language

frml: str = ''
data: str = ''
des: any = ''
scalars: str = ''
modelname: str = 'No Name'
start: int = 2017
end: int = 2040
country_trans()
country_df_trans()
from_wf2: bool = False
make_fitted: bool = False
fit_start: int = 2000
fit_end: int = 2100
do_add_factor_calc: bool = True
mfmsa: str = ''
static trans_eviews(rawmodel)[source]
property var_description

Adds var descriptions for add factors, exogenizing dummies and exoggenizing values

property mfmsa_options

Grab the mfmsa options, a world bank speciality

property mfmsa_start_end
property dfmodel

The original input data enriched with during variablees, variables containing values for specific historic years and model specific transformation

test_model(start=None, end=None, maxvar=1000000, maxerr=100, tol=0.0001, showall=False)[source]

Compares a straight calculation with the input dataframe.

shows which variables dont have the same value

Parameters:
  • df (TYPE) – dataframe to run.

  • start (TYPE, optional) – start period. Defaults to None.

  • end (TYPE, optional) – end period. Defaults to None.

  • maxvar (TYPE, optional) – how many variables are to be chekked. Defaults to 1_000_000.

  • maxerr (TYPE, optional) – how many errors to check Defaults to 100.

  • tol (TYPE, optional) – check for absolute value of difference. Defaults to 0.0001.

  • showall (TYPE, optional) – show more . Defaults to False.

Returns:

None.