Creating formulas
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. You can link multiple conditions with and and/or or. See if statements for more!
  • sample(3, 5): either the value 3 or the value 5 (discrete distribution)

The Basics

  • The syntax for basic operations is the same as Excel: + - * / ^ > < =
    • Not equal to is either <> or !=
  • You can reference variables in formulas by typing the variable name and selecting it from the autocomplete dropdown. You can also reference variables in other models if they're linked.
  • You can add comments to your formulas with a double slash // Everything between the double slash and the end of the line will be ignored by Causal when calculating. This is useful when you want to remind yourself (or others) what the formula is doing.
  • Click on Show Formulas in the top-left of the spreadsheet to see all the formulas in your model
Copy link