A variable is property of a person, or an entity (e.g. a family).
For instance:
Some variables can only be given as inputs of a simulation. For instance, the birth date of a person.
Other variables can be calculated thanks to a formula.
A formula is a function that calculates the value of given variable, for a given period. To do so, it performs (usually arithmetic) operations on the values of other variables, the formula dependencies.
For instance:
It is important to note that all variables can be used as inputs. This means that even if the basic income can be calculated from other variables, I can, for a given simulation, provide it as an input. Then, if another formula asks for the value of basic income for a month, the input value will be returned, and the basic income formula won’t be executed.
When OpenFisca is not able to calculate the value of a variable for a requested period, it returns a default value.
The default value of a variable is returned:
When the value of an input variables is requested, if this variable has not been set in the input for the requested period.
For example: Let’s assume the input variable
student
default value isFalse
. If the value ofstudent
for2017-09
has not been set in the input of the simulation, then computingstudent
for2017-09
will returnFalse
.
When the value of a variable with formulas is requested, if no formula is defined for the requested period.
For example: Let’s assume the variable
basic_income
‘s formula is defined starting2015-01-01
, and its default value is0
. Computingbasic_income
for2014-01-01
will return0
, while computingbasic_income
for2015-01-01
will use the formula.
Legislation writers can define a specific default value for each variable.