Comment on page

Creating variables

Variables are the building blocks of your models. If you're a spreadsheet user, you can think of them a bit like spreadsheet cells. If you're a programmer, you can think of them as, well, variables.
You can define a variable using a formula. Formulas let you work with numbers, ranges, and other variables. Here are some examples:
  • 25 : constant value of 25
  • 1 to 5 : range from 1 to 5 (technical detail: symmetric triangle distribution)
  • (0 to 1) * MyVariable : the product of a range and another variable
  • if VariableA > 10 then 1 else 0: self explanatory
  • sample(3, 5): either the value 3 or the value 5 (discrete distribution)
Note that Causal's syntax optimizes for human-readability and -writeability, i.e. you can enter $10,000 as $10k and Causal will understand.