Model Toolkit

Mathematical Modelling Software by Max Warner
Home  |  User Guide

Model Toolkit - User Guide


Terminology

Model toolkit supports two types of model - static and dynamic. Static models do not change with time, whereas dynamic models do. This means that the model 'code' is ran once for a static model and many times for a dynamic model.

Variables are split into three types - endogenous, exogenous and parameter. Endogenous variables are those which are determined by the model. Exogenous variables are constants which are determined outside of the model. Parameters are also constants which affect the workings of the model.

Model Syntax

Model toolkit has a simple and readable model syntax. Each line is parsed independently. A line can either be blank, a comment or a variable definition. A comment starts with a # or // and enables you to make notes which are ignored by the programme.

#this line will be ignored
//so will this one

Variable definitions are lines which define a variable as a function of other variables and/or constants. They are of the form variableName = something. Variable names can only contain letters of either case - no numbers or symbols.

The current (lots more to come) available operators are +, -, *, / and ^. You can also use brackets (( and )) to ensure the correct order of operations is followed. A variable declaration can use any number of operators, constants (e.g. 5.74) and variables. Variables do not need to be defined before using them (e.g. you can say a = b + c without needing to earlier write b = ...).

Here are some examples of valid variable declarations:

a = (b * c) + 10
d = (5e)^f

Functions enable you to call snippets of code from multiple locations without needing to repeat the code. Below is an example of a valid function declaration:

function test(a, b){
    return a * b
}

Function declaration follows the syntax function name(optional, arguments, ...){}. Within the curly braces, the last line should be a return statement of the type return variableName. A function can have as many arguments as you desire, including none.

Functions can then be called when declaring variables. For example, a = test(5, 6) will mean that a = 30.

There are also some built in mathematical functions:

  • exp(arg) returns e to the power of the argument
  • ln(arg) returns the natural logarithm of the argument

User Interface

You can use the file menu to open, save and create models. Model files are just JSON and the default extension is .model. When creating a new model, the new project window will ask you to select the model type and name.

The top bar features two/three buttons: run, reset and tick (dynamic models only). For a static model, the run button will evaluate the model. For a dynamic model, the run button will continually run the model until it reaches a steady state or the tick limit (1000). The reset button will reset the model values to their defaults, unless they have been manually set in the variables tab. For a dynamic model, the tick button will run the model once (the run button repeatedly ticks the model until a steady state/limit).

The Model Tab

The textarea contains the model 'code'. The table on the right lists the variables which are used in the model (you will need to run the model to update this). The table allows you to select the variable type and set the default value. If a variable is defined within the model, it will automatically be marked as endogenous.

The Variables Tab

The variables tab has tables for each variable type, which show their current values. These can be overriden by double clicking on the value, changing the value and then clicking the enter key.

The Variables Graph Tab (Dynamic Only)

This shows the selected endogenous variables as the model ticks.

The Comparative Statics Tab

This tab enables you to analyse how an endogenous variable changes as a parameter/exogenous variable changes.

The Details Tab

This tab allows you to change the model type and name.