I have a univariate time series `y_t` observed at times `t_t`, with optional capacity values `cap_t`, changepoints, and additional regressors. I want a Prophet-style trend model in which the mean combines a piecewise linear or logistic trend with additive and multiplicative regressors.

My model is:
`k ~ Normal(0, 5),`
`m ~ Normal(0, 5),`
`delta_s ~ DoubleExponential(0, tau), for s = 1, ..., S,`
`sigma_obs ~ half-Normal(0, 0.5),`
`beta_k ~ Normal(0, sigmas_k), for k = 1, ..., K.`

If `trend_indicator = 0`, then
`A_{ts} = 1(t_t >= t_change_s),`
`trend_t = (k + A_t^T delta) t_t + m - A_t^T (t_change .* delta),`
and if `trend_indicator = 1`, then
`k_0^* = k,`
`m_0^* = m,`
`k_s^* = k + sum_{l=1}^s delta_l, for s = 1, ..., S,`
`gamma_s = (t_change_s - m_{s-1}^*) (1 - k_{s-1}^* / k_s^*), for s = 1, ..., S,`
`m_s^* = m_{s-1}^* + gamma_s, for s = 1, ..., S,`
`trend_t = cap_t logit^{-1}((k + A_t^T delta) (t_t - (m + A_t^T gamma))).`

The observation model is
`y_t ~ Normal(trend_t (1 + x_t^T (beta .* s_m)) + x_t^T (beta .* s_a), sigma_obs), for t = 1, ..., T.`

Here:
`y_t` is the observed time-series value at time t,
`t_t` is the observation time,
`cap_t` is the carrying-capacity value used in the logistic-trend version,
`delta` is the vector of changepoint adjustments to the trend slope,
`A_t` is the row of changepoint indicators showing which changepoints have occurred by time t,
`gamma` is the vector of offsets needed to keep the logistic trend continuous across changepoints,
`t_change` is the vector of changepoint times,
`x_t` is the regressor row at time t,
`beta` is the regressor-coefficient vector,
`s_a` and `s_m` indicate which regressors enter additively and multiplicatively,
`k` is the base growth rate,
`m` is the trend offset,
`sigma_obs` is the observation-noise standard deviation,
`tau` is the scale parameter of the changepoint prior,
`sigmas` is the vector of prior scales for the regressors,
`trend_indicator` selects the linear-trend version when it equals 0 and the logistic-trend version when it equals 1,
`T` is the number of time periods,
`K` is the number of regressors,
`S` is the number of changepoints.

Parameterization notes:
In `Normal(mu, sigma)`, `sigma` is a standard deviation.
In `DoubleExponential(mu, sigma)`, `sigma` is a scale parameter.
