snowdrop.src package¶
Subpackages¶
- snowdrop.src.epidemic package
- snowdrop.src.graphs package
- snowdrop.src.gui package
- Submodules
- snowdrop.src.gui.clientGui module
Application
Application.Clean()
Application.CleanResults()
Application.Close()
Application.CloseFrame()
Application.FindSteadyState()
Application.GetImpulseResponseFunctions()
Application.OpenFile()
Application.OpenHistoryFile()
Application.ProcessCommands()
Application.Reset()
Application.RestoreSession()
Application.Run()
Application.Save()
Application.SaveSession()
Application.SaveTemplate()
Application.createWidgets()
Application.getEquation()
Application.getEquationLabels()
Application.removeFigures()
SaveTemplateOutput()
SaveYamlOutput()
checkNumberOfEquationsAndVariables()
createCheckBoxWidget()
createLabel()
createListBoxWidget()
createRadioButtonWidget()
createTableWidget()
createTextBoxWidget()
getDescription()
getEquations()
getExogVariables()
getFormattedTimeRange()
getFrequency()
getParamRange()
getParameterNamesAndValues()
getParameters()
getPeriods()
getShockNamesAndValues()
getShocks()
getTimeRange()
getVariableNamesAndInitialValues()
getVariables()
output()
readFile()
- snowdrop.src.gui.dialog module
- snowdrop.src.gui.multiColumnListBox module
Column
Multicolumn_Listbox
Multicolumn_Listbox.List_Of_Columns
Multicolumn_Listbox.List_Of_Rows
Multicolumn_Listbox.bind()
Multicolumn_Listbox.cell_data()
Multicolumn_Listbox.clear()
Multicolumn_Listbox.column_data()
Multicolumn_Listbox.configure_column()
Multicolumn_Listbox.delete_all_selected_rows()
Multicolumn_Listbox.delete_row()
Multicolumn_Listbox.deselect_all()
Multicolumn_Listbox.deselect_row()
Multicolumn_Listbox.destroy()
Multicolumn_Listbox.focus()
Multicolumn_Listbox.font
Multicolumn_Listbox.indices_of_selected_rows
Multicolumn_Listbox.insert_row()
Multicolumn_Listbox.item_ID()
Multicolumn_Listbox.item_ID_to_row_data()
Multicolumn_Listbox.number_of_columns
Multicolumn_Listbox.number_of_rows
Multicolumn_Listbox.row_data()
Multicolumn_Listbox.row_height
Multicolumn_Listbox.select_row()
Multicolumn_Listbox.selected_rows
Multicolumn_Listbox.set_selection()
Multicolumn_Listbox.sort_by()
Multicolumn_Listbox.state()
Multicolumn_Listbox.table_data
Multicolumn_Listbox.toogle_selection()
Multicolumn_Listbox.update()
Multicolumn_Listbox.update_cell()
Multicolumn_Listbox.update_column()
Multicolumn_Listbox.update_row()
Row
- snowdrop.src.gui.mytable module
- snowdrop.src.gui.scrollableTable module
- snowdrop.src.gui.table module
- snowdrop.src.gui.temp module
- Module contents
- snowdrop.src.info package
- Submodules
- snowdrop.src.info.graph module
Graph
Graph.BCC()
Graph.BCCUtil()
Graph.Delta()
Graph.addEdge()
Graph.add_edge()
Graph.add_vertex()
Graph.connected()
Graph.degree_sequence()
Graph.delta()
Graph.density()
Graph.diameter()
Graph.edges()
Graph.erdoes_gallai()
Graph.find()
Graph.find_all_paths()
Graph.find_distance()
Graph.find_isolated_vertices()
Graph.find_path()
Graph.find_shortest_path()
Graph.getBiconnectedComponents()
Graph.getMinimumSpanningTree()
Graph.get_components()
Graph.get_connected_vertices()
Graph.get_vertices()
Graph.isCyclic()
Graph.is_connected()
Graph.is_degree_sequence()
Graph.printBiconnectedComponents()
Graph.summary()
Graph.union()
Graph.vertex_degree()
Graph.vertices()
LinkedList
Node
- snowdrop.src.info.graphs module
- snowdrop.src.info.test module
- Module contents
- snowdrop.src.misc package
- Submodules
- snowdrop.src.misc.display module
- snowdrop.src.misc.info module
- snowdrop.src.misc.latex module
Apply
ExprTransformer
ExprVisitor
LatexVisitor
LatexVisitor.generic_prec()
LatexVisitor.generic_visit()
LatexVisitor.prec()
LatexVisitor.prec_Add()
LatexVisitor.prec_BinOp()
LatexVisitor.prec_Call()
LatexVisitor.prec_Div()
LatexVisitor.prec_FloorDiv()
LatexVisitor.prec_Invert()
LatexVisitor.prec_Mod()
LatexVisitor.prec_Mult()
LatexVisitor.prec_Name()
LatexVisitor.prec_Not()
LatexVisitor.prec_Num()
LatexVisitor.prec_Pow()
LatexVisitor.prec_RCall()
LatexVisitor.prec_RName()
LatexVisitor.prec_Sub()
LatexVisitor.prec_UAdd()
LatexVisitor.prec_USub()
LatexVisitor.prec_UnaryOp()
LatexVisitor.visit_Add()
LatexVisitor.visit_BinOp()
LatexVisitor.visit_BitAnd()
LatexVisitor.visit_BitOr()
LatexVisitor.visit_BitXor()
LatexVisitor.visit_Invert()
LatexVisitor.visit_LShift()
LatexVisitor.visit_Mod()
LatexVisitor.visit_Mult()
LatexVisitor.visit_Not()
LatexVisitor.visit_Num()
LatexVisitor.visit_RCall()
LatexVisitor.visit_RName()
LatexVisitor.visit_RShift()
LatexVisitor.visit_Sub()
LatexVisitor.visit_UAdd()
LatexVisitor.visit_USub()
LatexVisitor.visit_UnaryOp()
LatexVisitor.visit_Variable()
TimeShift
eq2tex()
expr2tex()
greekify()
name_to_latex()
parse()
split_name_into_parts()
- snowdrop.src.misc.linter module
- snowdrop.src.misc.termcolor module
- snowdrop.src.misc.text2latex module
- Module contents
- snowdrop.src.model package
- Submodules
- snowdrop.src.model.factory module
- snowdrop.src.model.interface module
- snowdrop.src.model.model module
- snowdrop.src.model.settings module
BoundaryCondition
BoundaryConditions
FilterAlgorithm
InitialCondition
PriorAssumption
SamplingAlgorithm
SamplingAlgorithm.Emcee
SamplingAlgorithm.Particle_gibbs
SamplingAlgorithm.Particle_pmmh
SamplingAlgorithm.Particle_smc
SamplingAlgorithm.Pymc3
SamplingAlgorithm.Pymcmcstat
SamplingAlgorithm.Pymcmcstat_am
SamplingAlgorithm.Pymcmcstat_dr
SamplingAlgorithm.Pymcmcstat_dram
SamplingAlgorithm.Pymcmcstat_mh
SmootherAlgorithm
SolverMethod
- snowdrop.src.model.util module
Data
expand()
expand_list()
expand_loop()
expand_map()
expand_minmax()
expand_obj_func_sum()
expand_prod()
expand_sum()
expand_sum_or_prod()
firstNonZero()
fix()
getConstraints()
getEquationsLables()
getIndex()
getLabels()
getLimits()
getStartingValues()
importModel()
lastNonZero()
loadLibrary()
print_path_solution_status()
replace_all()
setValues()
- Module contents
- snowdrop.src.numeric package
- Subpackages
- snowdrop.src.numeric.bayes package
- snowdrop.src.numeric.dp package
- Submodules
- snowdrop.src.numeric.dp.bellman module
- snowdrop.src.numeric.dp.collard module
- snowdrop.src.numeric.dp.discrete module
- snowdrop.src.numeric.dp.grids module
- snowdrop.src.numeric.dp.hjb module
- snowdrop.src.numeric.dp.olg module
- snowdrop.src.numeric.dp.tauchen module
- snowdrop.src.numeric.dp.test module
- snowdrop.src.numeric.dp.util module
- Module contents
- snowdrop.src.numeric.estimation package
- snowdrop.src.numeric.filters package
- Submodules
- snowdrop.src.numeric.filters.diffuse module
- snowdrop.src.numeric.filters.filter module
- snowdrop.src.numeric.filters.filters module
- snowdrop.src.numeric.filters.kalman module
- snowdrop.src.numeric.filters.particle module
- snowdrop.src.numeric.filters.py_kalman module
- snowdrop.src.numeric.filters.pykalman module
- snowdrop.src.numeric.filters.unscented module
- snowdrop.src.numeric.filters.utils module
- Module contents
- snowdrop.src.numeric.grids package
- snowdrop.src.numeric.optimization package
- snowdrop.src.numeric.sa package
- snowdrop.src.numeric.solver package
- Subpackages
- Submodules
- snowdrop.src.numeric.solver.ABLR module
- snowdrop.src.numeric.solver.AndersonMoore module
- snowdrop.src.numeric.solver.Benes module
- snowdrop.src.numeric.solver.BinderPesaran module
- snowdrop.src.numeric.solver.LBJ module
- snowdrop.src.numeric.solver.Villemot module
- snowdrop.src.numeric.solver.linear_solver module
- snowdrop.src.numeric.solver.nonlinear_solver module
- snowdrop.src.numeric.solver.solver module
- snowdrop.src.numeric.solver.solvers module
- snowdrop.src.numeric.solver.tunes module
- snowdrop.src.numeric.solver.util module
- Module contents
- Module contents
- Subpackages
- snowdrop.src.preprocessor package
- Submodules
- snowdrop.src.preprocessor.codegen module
SourceGenerator
SourceGenerator.body()
SourceGenerator.body_or_else()
SourceGenerator.decorators()
SourceGenerator.newline()
SourceGenerator.signature()
SourceGenerator.visit_Assert()
SourceGenerator.visit_Assign()
SourceGenerator.visit_Attribute()
SourceGenerator.visit_AugAssign()
SourceGenerator.visit_BinOp()
SourceGenerator.visit_BoolOp()
SourceGenerator.visit_Break()
SourceGenerator.visit_Bytes()
SourceGenerator.visit_Call()
SourceGenerator.visit_ClassDef()
SourceGenerator.visit_Compare()
SourceGenerator.visit_Continue()
SourceGenerator.visit_Delete()
SourceGenerator.visit_Dict()
SourceGenerator.visit_DictComp()
SourceGenerator.visit_Ellipsis()
SourceGenerator.visit_Expr()
SourceGenerator.visit_ExtSlice()
SourceGenerator.visit_For()
SourceGenerator.visit_FunctionDef()
SourceGenerator.visit_GeneratorExp()
SourceGenerator.visit_Global()
SourceGenerator.visit_If()
SourceGenerator.visit_IfExp()
SourceGenerator.visit_Import()
SourceGenerator.visit_ImportFrom()
SourceGenerator.visit_Lambda()
SourceGenerator.visit_List()
SourceGenerator.visit_ListComp()
SourceGenerator.visit_Name()
SourceGenerator.visit_Nonlocal()
SourceGenerator.visit_Num()
SourceGenerator.visit_Pass()
SourceGenerator.visit_Print()
SourceGenerator.visit_Raise()
SourceGenerator.visit_Repr()
SourceGenerator.visit_Return()
SourceGenerator.visit_Set()
SourceGenerator.visit_SetComp()
SourceGenerator.visit_Slice()
SourceGenerator.visit_Starred()
SourceGenerator.visit_Str()
SourceGenerator.visit_Subscript()
SourceGenerator.visit_TryExcept()
SourceGenerator.visit_TryFinally()
SourceGenerator.visit_Tuple()
SourceGenerator.visit_UnaryOp()
SourceGenerator.visit_While()
SourceGenerator.visit_With()
SourceGenerator.visit_Yield()
SourceGenerator.visit_alias()
SourceGenerator.visit_arg()
SourceGenerator.visit_arguments()
SourceGenerator.visit_comprehension()
SourceGenerator.visit_excepthandler()
SourceGenerator.write()
test_generation()
to_source()
- snowdrop.src.preprocessor.condition module
- snowdrop.src.preprocessor.eval_formula module
- snowdrop.src.preprocessor.eval_solver module
- snowdrop.src.preprocessor.f_dynamic module
- snowdrop.src.preprocessor.f_jacob module
- snowdrop.src.preprocessor.f_measurement module
- snowdrop.src.preprocessor.f_rhs module
- snowdrop.src.preprocessor.f_sparse module
- snowdrop.src.preprocessor.f_steady module
- snowdrop.src.preprocessor.function module
- snowdrop.src.preprocessor.function_compiler module
- snowdrop.src.preprocessor.function_compiler_sympy module
- snowdrop.src.preprocessor.functions module
- snowdrop.src.preprocessor.language module
- snowdrop.src.preprocessor.misc module
- snowdrop.src.preprocessor.objects module
- snowdrop.src.preprocessor.pattern module
- snowdrop.src.preprocessor.processes module
- snowdrop.src.preprocessor.processes_new module
- snowdrop.src.preprocessor.processes_old module
- snowdrop.src.preprocessor.recipes module
- snowdrop.src.preprocessor.steady module
- snowdrop.src.preprocessor.steady_state module
- snowdrop.src.preprocessor.symbolic module
Compare
ExpressionChecker
ExpressionLogNormalizer
ExpressionNormalizer
ListNames
ListSymbols
StandardizeDatesSimple
TimeShiftTransformer
check_expression()
compare()
destringify()
eval_scalar()
get_names()
list_variables()
log_normalize()
log_stringify_variable()
match()
normalize()
parse_string()
std_tsymbol()
stringify()
stringify_parameter()
stringify_symbol()
stringify_variable()
time_shift()
timeshift()
- snowdrop.src.preprocessor.symbolic_eval module
NumericEval
NumericEval.eval()
NumericEval.eval_commentedmap()
NumericEval.eval_commentedseq()
NumericEval.eval_dict()
NumericEval.eval_float()
NumericEval.eval_float64()
NumericEval.eval_int()
NumericEval.eval_list()
NumericEval.eval_ndarray()
NumericEval.eval_nonetype()
NumericEval.eval_ordereddict()
NumericEval.eval_scalarfloat()
NumericEval.eval_str()
- snowdrop.src.preprocessor.util module
- Module contents
- snowdrop.src.samples package
- Submodules
- snowdrop.src.samples.alternatives module
- snowdrop.src.samples.forecast module
- snowdrop.src.samples.fpe_model module
- snowdrop.src.samples.in_sample module
- snowdrop.src.samples.in_sample_mpaf module
- snowdrop.src.samples.judgements module
- snowdrop.src.samples.kalmanfilter module
- snowdrop.src.samples.kalmanfilter_mpaf module
- snowdrop.src.samples.makedata module
- snowdrop.src.samples.makedata_mpaf module
- snowdrop.src.samples.modelproperties module
- snowdrop.src.samples.modelproperties_mpaf module
- Module contents
- snowdrop.src.tests package
- snowdrop.src.utils package
- Submodules
- snowdrop.src.utils.compareResults module
- snowdrop.src.utils.d2s module
- snowdrop.src.utils.db module
- snowdrop.src.utils.decorators module
- snowdrop.src.utils.distributions module
- snowdrop.src.utils.equations module
aggregateEqs()
build_func()
check_presence()
findVar()
fixEquation()
fixEquations()
fixExpression()
getColumns()
getExogMatrix()
getForwardBackwardRowsColumns()
getIncidenceMap()
getLeadLagIncidence()
getLeadVariables()
getMap()
getMaxLeadAndLag()
getMaxLeadsLags()
getRHS()
getRowsColumns()
getStableUnstableVariables()
getStateVariables()
getTopology()
getTopologyOfVariables()
getVarRowsIncidence()
getVariablesOrder()
getVariablesRowsAndColumns()
get_steady_state_equations()
modifyEquations()
normalizeEq()
processFormulas()
replaceEq()
str2func()
topology()
transformEq()
- snowdrop.src.utils.getData module
- snowdrop.src.utils.getDynareData module
- snowdrop.src.utils.getIrisData module
- snowdrop.src.utils.getTemplateData module
- snowdrop.src.utils.getYamlData module
- snowdrop.src.utils.grids module
- snowdrop.src.utils.html2pdf module
- snowdrop.src.utils.interface module
- snowdrop.src.utils.load module
- snowdrop.src.utils.merge module
- snowdrop.src.utils.merge2 module
- snowdrop.src.utils.prettyTable module
PrettyTable
PrettyTable.add_column()
PrettyTable.add_row()
PrettyTable.align
PrettyTable.attributes
PrettyTable.border
PrettyTable.clear()
PrettyTable.clear_rows()
PrettyTable.copy()
PrettyTable.del_row()
PrettyTable.end
PrettyTable.field_names
PrettyTable.fields
PrettyTable.float_format
PrettyTable.format
PrettyTable.get_html_string()
PrettyTable.get_string()
PrettyTable.header
PrettyTable.header_style
PrettyTable.horizontal_char
PrettyTable.hrules
PrettyTable.int_format
PrettyTable.junction_char
PrettyTable.left_padding_width
PrettyTable.max_width
PrettyTable.padding_width
PrettyTable.reversesort
PrettyTable.right_padding_width
PrettyTable.set_style()
PrettyTable.sort_key
PrettyTable.sortby
PrettyTable.start
PrettyTable.valign
PrettyTable.vertical_char
PrettyTable.vrules
TableHandler
from_csv()
from_db_cursor()
from_html()
from_html_one()
main()
- snowdrop.src.utils.progressbar module
- snowdrop.src.utils.sortSchur module
- snowdrop.src.utils.table module
- snowdrop.src.utils.util module
Encoder
MyDict
Output()
SaveToYaml()
caseInsensitiveDict()
compare()
compareResults()
compareTrollFiles()
correctHeaderOfCsvFile()
correctHeaders()
correctLabel()
correctVariablesNames()
create_config_file()
deleteFiles()
findVariableLag()
findVariableLead()
getDate()
getExogenousSeries()
getMap()
getNamesAndValues()
getNamesValues()
getOutputFolderPath()
getPeriods()
getVariableValue()
importModel()
isPositiveDefinite()
loadData()
nearestPositiveDefinite()
output()
read()
readDataFromDatabase()
readDataFromExcel()
read_and_combine_text()
replaceExpressions()
save()
saveData()
saveLeadLagIncidence()
saveScenariosToExcel()
saveTimeSeries()
saveToDatabase()
saveToExcel()
simulationRange()
tracefunc()
- Module contents
Submodules¶
snowdrop.src.driver module¶
Created on Tue Mar 13, 2018 Driver program of Python framework.
@author: A.Goumilevski
- snowdrop.src.driver.estimate(fname=None, model=None, y0=None, output_variables=None, fout=None, Plot=False, Output=False, output_dir=None, meas=None, Prior=None, estimate_Posterior=False, estimateOnly=False, algorithm='SLSQP', burn=50, Ndraws=300, Niter=100, sample=False, resetParameters=False, Parallel=False, method=None, fit_data_only=False, estimate_ML=False, runKalmanFilter=True)[source]¶
Estimates model parameters.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param y0:
Starting (or guessed) values of the solution.
- type y0:
numpy array.
- param fout:
Path to output excel file.
- type fout:
str.
- param Plot:
Boolean variable.If this flag is raised then plots graphs.
- type Plot:
bool.
- param decomp_variables:
List of decomposition variables.
- param Output:
If set outputs simulation results to excel file and Python sqlite database.
- type Output:
bool.
- param output_dir:
Path to output directory.
- type output_dir:
str.
- param meas:
Path to a file with measurement data.
- type meas:
str.
- type Prior:
str.
- param estimate_Posterior:
If this flag is raised, then calibrate model parameters and apply Kalman Filter with the new calibrated parameters.
- type estimate_Posterior:
bool.
- param estimateOnly:
If this flag is raised, then only estimate model parameters.
- type estimateOnly:
bool.
- param algorithm:
Algorithm applied to minimiza likelihood function.
- type algorith:
str.
- param burn:
Number of samples to discard.
- type burn:
int.
- param Ndraws:
The number of draws of Markov Chain Monte Carlo parameters sampling.
- type Ndraws:
int.
- param Niter:
The number of iterations. It is used in Markov Chain Monte Carlo sampling of parameters.
- type Niter:
int.
- param sample:
Boolean variable. If this flag is raised then run Markov Chain Monte Carlo parameters sampling.
- type sample:
bool.
- param resetParameters:
If True resets parameters to the samples mean values.
- type resetParameters:
bool
- param method:
Algorithm of Markov Chain Monte Carlo sampling.
- type method:
str.
- param fit_data_only:
If True calibrate model parameters by minimizing sum of standard deviations of errors of model fit to data. Otherwise, calibrate model by maximizing sum of the prior likelihood of model parameters and the likelihood of model fit to data.
- type fit_data_only:
bool
- param estimate_ML:
If True estimate maimum likelihood only.
- type estimate_ML:
bool.
- param runKalmanFilter:
If True runs Kalman filter after estimation, otherwise - runs forecast,
- type runKalmanFilter:
bool.
- returns:
Model estimation.
- snowdrop.src.driver.findEigenValues(fname=None, model=None, steady_state=None)[source]¶
Find eigen values of system of equations at steady state.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param Output:
Boolean variable. If set saves steady state solution to excel file and sqlite database.
- type Output:
bool.
- returns:
Steady state solution.
- snowdrop.src.driver.findSteadyStateSolution(fname=None, model=None, Output=False, excel_dir=None, debug=False)[source]¶
Find steady state solution.
This function uses variables starting values as initial condition for an iterative algorithm.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param Output:
Boolean variable. If set saves steady state solution to excel file and sqlite database.
- type Output:
bool.
- param excel_dir:
Pth to directory where excel steady state file will be saved.
- type excel_dir:
str.
- returns:
Steady state solution.
- snowdrop.src.driver.findSteadyStateSolutions(fname=None, model=None, number_of_steps=10, par_range={}, Plot=False, Output=False)[source]¶
Find steady state solution for a range of parameters.
The parameters range is defined in the “options” sections of YAML model file.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param number_of_steps:
Number of steps of parameter range.
- type number_of_steps:
int.
- param par_range:
Parameters range.
- type par_range:
dictionary.
- param Plot:
Boolean variable. If set to True shows graphs.
- type Plot:
bool.
- param Output:
Boolean variable. If set to True saves graphs.
- type Output:
bool.
- returns:
List of steady state arrays for given parameter range.
- snowdrop.src.driver.getImpulseResponseFunctions(fname, Plot=False, Output=False)[source]¶
Get impulse response functions (IRF).
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- type Plot:
bool.
- param Output:
Boolean variable. If set then saves graphs.
- type Output:
bool.
- returns:
IRF for given parameters.
- snowdrop.src.driver.importModel(fname, order=1, hist=None, boundary_conditions_path=None, exogenous=None, InitCondition=None, Prior=None, estimate=False, Solver=None, Filter=None, Smoother=None, shocks_file_path=None, steady_state_file_path=None, measurement_file_path=None, calibration_file_path=None, use_cache=False, SamplingMethod=None, anticipate=None, model_info=False, graph_info=False, bSparse=False)[source]¶
Import model.
- Parameters:
- param fname:
The path to yaml file name.
- type fname:
str.
- param order:
Approximation order of solution of the non-linear system of equations.
- type order:
int.
- param hist:
Path to the history excel file.
- type hist:
str.
- param boundary_conditions_path:
Path to the boundary conditions excel file. This file contains initial and terminal conditions.
- type boundary_conditions_path:
str.
- param exogenous:
List of exogenous variables.
- type exogenous:
list.
- param InitCondition:
Endogenous variables initial condition method.
- type InitCondition:
str.
- param Prior:
Error covariance matrix estimation method.
- type Prior:
str.
- param estimate:
If True estimate model parameters.
- type estimate:
bool.
- param Solver:
Solver algorithm.
- type Solver:
str.
- param Filter:
KF filter algorithm.
- type Filter:
str.
- param Smoother:
KF smoother algorithm.
- type Smoother:
str.
- param shocks_file_path:
Path to shock file.
- type shocks_file_path:
str.
- param steady_state_file_path:
Path to steady-state file.
- type steady_state_file_path:
str.
- param measurement_file_path:
Path to a file with measurement data.
- type measurement_file_path:
str.
- param calibration_file_path:
Path to calibration files or a file.
- type calibration_file_path:
list or str.
- param use_cache:
If True reads previously saved model from a file of model dump.
- type use_cache:
bool.
- param anticipate:
If True future shocks are anticipated.
- type anticipate:
bool.
- param model_info:
If True creates a pdf/latex model file.
- type model_info:
bool.
- param graph_info:
If True displays graph of model equations. The default is False.
- type graph_info:
bool, optional
- param bSparse:
Use sparse matrix algebra.
- type bSparse:
bool.
- returns:
Instance of Model class.
- snowdrop.src.driver.kalman_filter(fname=None, model=None, y0=None, T=-1, output_variables=None, fout=None, Plot=False, decomp_variables=None, anticipate=None, Output=False, output_dir=None, hist=None, meas=None, InitCondition=None, Prior=None, calibration_file_path=None, Solver=None, Filter=None, Smoother=None)[source]¶
Runs Kalman filtering.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param y0:
Starting (or guessed) values of the solution.
- type y0:
numpy array.
- param T:
Number of time periods.
- type T:
int.
- param output_variables:
output variables.
- type output_variables:
list.
- param Plot:
Boolean variable.If this flag is raised then plots graphs.
- type Plot:
bool.
- param decomp_variables:
List of decomposition variables.
- type decomp_variables:
list.
- param anticipate:
It True then future shocks are anticipated.
- type anticipate:
bool.
- param Output:
If set outputs simulation results to excel file and Python sqlite database.
- type Output:
bool.
- param output_dir:
Path to output directory.
- type output_dir:
str.
- param hist:
Path to history excel file. It contains starting and terminal values of endogenous variables.
- type hist:
str.
- param boundary_conditions_path:
Path to the boundary conditions excel file. This file contains initial and terminal conditions.
- type boundary_conditions_path:
str.
- param meas:
Path to a file with measurement data.
- type meas:
str.
- param InitCondition:
(StartingValues,SteadyState) If StartingValues then use starting values If SteadyState then use steady state as starting values
- type InitialCondition:
str.
- param Prior:
(StartingValues,DiffusePrior,Equilibrium) If Rosenberg then applies algorithm to find initial values of state variables. If StartingValues then use starting values for covariance matrices If SteadyState then use steady state for covariance matrices If Equilibrium then solve Lyapunov equation to find steady state covariance matrices.
- type Prior:
str.
- param estimate_Posterior:
If this flag is raised, then calibrate model parameters and apply Kalman Filter with the new calibrated parameters.
- type estimate_Posterior:
bool.
- param fout:
Path to output excel file.
- type fout:
str.
- param calibration_file_path:
Path to a calibration file or files.
- type calibration_file_path:
str or list.
- param Solver:
Name of numerical method to solve the system of equations.
- type Solver:
str.
- param Filter:
Name of Kalman filter algorithm.
- type Filter:
str.
- param Smoother:
Name of Kalman filter smoother algorithm.
- type Smoother:
str.
- param calibration_file_path:
If True the transition equations, variables, shocks are combined with the measurement ones.
- type calibration_file_path:
bool.
- returns:
Kalman filter results.
- snowdrop.src.driver.optimize(fpath=None, fout=None, Output=False, plot_variables=None, model_info=False)[source]¶
Call main driver program.
Runs model optimization.
- Parameters:
- param fpath:
Path to model file.
- type fpath:
str.
- param fout:
Path to output excel file.
- type fout:
str.
- param Output:
If set outputs simulation results to excel file and Python sqlite database.
- type Output:
bool.
- param output_dir:
Path to output directory.
- type output_dir:
str.
- param plot_variables:
Names of variables to plot.
- type plot_variables:
list.
- param model_info:
If True creates a pdf/latex model file.
- type model_info:
bool.
- returns:
Optimization results.
- snowdrop.src.driver.run(fname=None, model=None, y0=None, order=1, T=-1, Tmax=1000000.0, irf=False, prefix=None, output_variables=None, Plot=False, decomp_variables=None, anticipate=None, PlotSurface=False, Plot3D=False, Output=False, output_dir=None, hist=None, boundary_conditions_path=None, exogenous=None, meas=None, InitCondition=None, Prior=None, estimate_Posterior=False, estimateOnly=False, algorithm='SLSQP', burn=50, Ndraws=300, Niter=100, sample=False, resetParameters=False, Parallel=False, method=None, fout=None, MULT=1, shocks_file_path=None, steady_state_file_path=None, calibration_file_path=None, Solver=None, Filter=None, Smoother=None, fit_data_only=False, estimate_ML=False, header=None, opt_ss_continue=True, graph_info=False, use_cache=False, model_info=False, Sparse=False, runKalmanFilter=False, orth_shocks=None)[source]¶
Main driver program.
It runs simulations, finds steady state solution, plots graphs, and saves results to excel files and Python sqlite databases.
- Parameters:
- param fname:
Path to model file.
- type fname:
str.
- param model:
Model object.
- type model:
Model.
- param y0:
Starting (or guessed) values of the solution.
- type y0:
numpy array.
- param order:
Approximation order of non-linear system of equations.
- type order:
int.
- param T:
Number of time periods.
- type T:
int.
- param Tmax:
Maximum number of periods to display in graphs.
- type Tmax:
int.
- param irf:
IRF variable.
- type irf:
int.
- param prefix:
Prefix name. It is used to plot and output variables which name starts with prefix.
- type prefix:
str.
- param output_variables:
output variables.
- type output_variables:
list.
- param Plot:
Boolean variable.If this flag is raised then plots graphs.
- type Plot:
bool.
- param decomp_variables:
List of decomposition variables.
- type decomp_variables:
list.
- param anticipate:
It True then future shocks are anticipated.
- type anticipate:
bool.
- param PlotSurface:
Boolean variable. If this flag is raised then plots 2D graphs.
- type PlotSurface:
bool.
- param Plot3D:
Boolean variable. If this flag is raised then plots 3D graphs.
- type Plot3D:
bool.
- param Output:
If set outputs simulation results to excel file and Python sqlite database.
- type Output:
bool.
- param output_dir:
Path to output directory.
- type output_dir:
str.
- param hist:
Path to history excel file. It contains starting and terminal values of endogenous variables.
- type hist:
str.
- param boundary_conditions_path:
Path to the boundary conditions excel file. This file contains initial and terminal conditions.
- type boundary_conditions_path:
str.
- param exogenous:
List of exogenous variables.
- type exogenous:
list.
- param meas:
Path to a file with measurement data.
- type meas:
str.
- param InitCondition:
(StartingValues,SteadyState) If StartingValues is set, then use starting values If SteadyState is set, then use steady state as starting values
- param Prior:
(StartingValues,DiffusePrior,Equilibrium) If Rosenberg then applies algorithm to find initial values of state variables. If StartingValues then use starting values for covariance matrices If SteadyState then use steady state for covariance matrices If Equilibrium then solve Lyapunov equation to find steady state covariance matrices.
- type Prior:
str.
- param estimate_Posterior:
If this flag is raised, then calibrate model parameters and apply Kalman Filter with the new calibrated parameters.
- type estimate_Posterior:
bool.
- param estimateOnly:
If this flag is raised, then only estimate model parameters.
- type estimateOnly:
bool.
- param algorithm:
Algorithm applied to minimiza likelihood function.
- type algorith:
str.
- param burn:
Number of samples to discard.
- type burn:
int.
- param Ndraws:
The number of draws of Markov Chain Monte Carlo parameters sampling.
- type Ndraws:
int.
- param Niter:
The number of iterations. It is used in Markov Chain Monte Carlo sampling of parameters.
- type Niter:
int.
- param sample:
Boolean variable. If this flag is raised then run Markov Chain Monte Carlo parameters sampling.
- type sample:
bool.
- param resetParameters:
If True resets parameters to the samples mean values.
- type resetParameters:
bool
- param method:
Algorithm of Markov Chain Monte Carlo sampling.
- type method:
str.
- param fout:
Path to output excel file.
- type fout:
str.
- param MULT:
Multiplier defining terminal time. If set greater than one than solution will be computed for this extended time range interval.
- type MULT:
float.
- param shocks_file_path:
Path to shock file.
- type shocks_file_path:
str.
- param steady_state_file_path:
Path to steady-state file.
- type steady_state_file_path:
str.
- param calibration_file_path:
Path to a calibration file or files.
- type calibration_file_path:
str or list.
- param Solver:
Name of numerical method to solve the system of equations.
- type Solver:
str.
- param Filter:
Name of Kalman filter algorithm.
- type Filter:
str.
- param Smoother:
Name of Kalman filter smoother algorithm.
- type Smoother:
str.
- param fit_data_only:
If True calibrate model parameters by minimizing sum of standard deviations of errors of model fit to data. Otherwise, calibrate model by maximizing sum of the prior likelihood of model parameters and the likelihood of model fit to data.
- type fit_data_only:
bool
- param estimate_ML:
If True estimate maimum likelihood only.
- type estimate_ML:
bool.
- param header:
Graph header.
- type header:
str.
- param opt_ss_continue:
If set and steady state solution is invalid, then find steady state and continue simulations.
- type opt_ss_continue:
bool.
- param graph_info:
If True shows model equations graph.
- type graph_info:
bool.
- param calibration_file_path:
If True the transition equations, variables, shocks are combined with the measurement ones.
- type calibration_file_path:
bool.
- param use_cache:
If True reads previously saved model from a file of model dump.
- type use_cache:
bool.
- param model_info:
If True creates a pdf/latex model file.
- type model_info:
bool.
- param Sparse:
If True use sparse matrices algebra.
- type Sparse:
bool.
- param runKalmanFilter:
If True runs Kalman Filter.
- type runKalmanFilter:
bool.
- param orth_shocks:
If True shocks are orthogonalized (applied only for linear models).
- type orth_shocks:
bool.
- returns:
Simulation results.
- snowdrop.src.driver.setParameters(model, order, Solver, Filter, Smoother, Prior, InitCondition, SamplingMethod=None)[source]¶
Set model parameters.
- Parameters:
- param model:
Model object.
- type fname:
Model.
- param order:
Approximation order of solution of non-linear system of equations.
- type order:
int.
- param Solver:
Solver algorithm.
- type Solver:
str.
- param Filter:
KF filter algorithm.
- type Filter:
str.
- param Smoother:
KF smoother algorithm.
- type Smoother:
str.
- param Prior:
Error covariance matrix estimation method.
- type Prior:
str.
- param InitCondition:
Endogenous variables initial condition method.
- type InitCondition:
str.
- param SamplingMethod:
Markov Chain Monte Carlo sampling algorithm.
- type SamplingMethod:
str.
- returns:
Instance of Model class.