Examples
  • Spread Function: The spread function allows you to spread a value, or a set of values, over a time period. You can think of it as similar in functionality to sumproduct in Excel, but more intuitive (and of course, more powerful). Check out our forum post about the spread function here: https://community.causal.app/t/how-do-i-use-the-spread-function-in-causal/33
  • Internal rate of return (IRR): Causal has lots of finance functions that you might know from Excel or Google Sheets - and they work very similar! For example if you have a "Cash Flows" variable where the first value is the initial investment and the following values are the returns, you can calculate the IRR like this:
  • Internal rate of return for a schedule of cash flows (XIRR): XIRR is used when the cash flows are not periodic. That's why XIRR needs three arguments: the cashflows, the time steps at which they occur, and the granularity (how many time steps fit into one year). E.g. if you invest $10 in the first month and have a return of $6 after 10 months and another $6 after 12 months, your formula would look like this:
  • Net Present Value (NPV): Net Present Value (NPV) compares the money received in the future to an amount of money received today, while accounting for time and interest. The arguments of the function are (rate in percent, cash flows). So for a discount rate of 10%, an initial investment of 500 and cashflows of 200, 300 and 200 you can use the function like this: finance.npv(10, -500, 200, 300, 200). Usually the cashflows are in a time series variable, in this case you can use the variable in the function:
Copy link