Transform Reference
Financial & Statistical Verbs
Time value of money calculations (compound interest, loan payments, future/present value) and statistical functions.
Time Value of Money
| Verb | Syntax | Description | Try It |
|---|---|---|---|
| compound | %compound @principal @rate @periods | Future value: P * (1 + r)^n | Try |
| discount | %discount @fv @rate @periods | Present value: FV / (1 + r)^n | Try |
| pmt | %pmt @principal @rate @periods | Payment for loan | Try |
| fv | %fv @payment @rate @periods | Future value of annuity | Try |
| pv | %pv @payment @rate @periods | Present value of annuity | Try |
| npv | %npv @rate @cashflows | Net present value | Try |
Statistics (Array-Based)
| Verb | Syntax | Description | Try It |
|---|---|---|---|
| std | %std @array.field | Standard deviation (population) | Try |
| median | %median @array.field | Median value | Try |
| mode | %mode @array.field | Most frequent value | Try |
| percentile | %percentile @array.field @pct | Nth percentile (0-100) | Try |
| correlation | %correlation @arr1 @arr2 | Pearson correlation | Try |
| movingAvg | %movingAvg @array ##windowSize | Rolling window average (partial window at start) | Try |
Reference
Moving Average (movingAvg) — Rolling Window
Computes a rolling (moving) average over an array of numeric values. Returns an array of the same length as the input.
- Window size must be a positive integer (≥ 1).
- Partial windows are used at the start — the first element averages just itself, the second averages elements 0–1, etc., until the full window size is reached.
- Non-numeric values in the array are treated as
0. - Returns null if input is not an array or window size is invalid.
Example: %movingAvg [10, 20, 30, 40, 50] ##3 → [10, 15, 20, 30, 40]
Examples
Financial/statistical examples
; Time value of money
future_value = %compound ##10000 #0.05 ##10 ; 10000 * 1.05^10 -> 16288.95
; Statistics
volatility = %std @claims.amount ; Standard deviation
median_premium = %median @policies.premium ; Middle value
q3 = %percentile @values ##75 ; 75th percentile
; Rolling average
smoothed = %movingAvg @dailyValues ##3 ; 3-period rolling avg