For a vector $x_i$ and numeric values $\theta_j$ and $\beta_j$, I can write this vectorized calculation in R:
y = (x > theta1) * beta1 + (x > theta2) * beta2 + (x > theta3) * beta3
In programming, x > theta1
evaluates to TRUE
(1) and FALSE
(0) and multiplication is straightforward. But how do I write this as a mathematical expression? This was my first hunch, but I'm not sure it would fare well:
$$ \begin{align} y_i =& (x_i > \theta_1) \beta_1 + (x > \theta_2) \beta_2 + (x > \theta_3) \beta_3 \\ =& \sum_{j = 1}^{3} (x_i > \theta_j) \beta_j \end{align} $$
I would like to avoid a notation where the cumulative nature of the expression is less obvious and which quickly grows overly long. I have many more terms and comparators in actual equations.
$$ y_i = \begin{cases} \beta_1 & \text{if } x_i > \theta_1 \\ \beta_1 + \beta_2 & \text{if } x_i > \theta_2 \\ \beta_1 + \beta_2 + \beta_3 & \text{if } x_i > \theta_3 \\ \end{cases} $$
$x_i$ and $\theta_j$ are monotonically increasing.