ResolvedPowerPriceResponse#
- class pymc_marketing.mmm.price_response.ResolvedPowerPriceResponse(*, gamma, reference_spend, max_slope_ratio, dims, label)[source]#
The iso-elastic map bound to a layout, with a quadratic floor at low spend.
Above the floor \(s_f\), with \(\text{scale} = s_{\text{ref}}^{\gamma}\):
\[u(s) = \frac{\text{scale}\, s^{1-\gamma}}{p_0}, \qquad p(s) = p_0 \left(\frac{s}{s_{\text{ref}}}\right)^{\gamma}, \qquad m(s) = \frac{p(s)}{1 - \gamma}\]Below it \(u(s) = (a s + b s^2) / p_0\) with \(a = (1+\gamma)\,\text{scale}\, s_f^{-\gamma}\) and \(b = -\gamma\,\text{scale}\, s_f^{-\gamma-1}\), which pins \(u(0) = 0\), matches value and slope at \(s_f\) (the map is C1), and stays concave and increasing. There \(p(s) = p_0 / (a + b s)\) and \(m(s) = p_0 / (a + 2 b s)\); both are continuous at \(s_f\) and both tend to \(p_0 / a\) as spend falls to zero, so \(m = p / (1 - \gamma)\) holds on the power branch only. At zero nothing is bought, so \(p\) is
nanthere while \(m(0) = p_0 / a\).The floor is where the slope spread the solver can meet is capped, \(u'(0) / u'(s_{\text{ref}}) = M\), which gives \(s_f / s_{\text{ref}} = \max\big((M (1-\gamma)/(1+\gamma))^{-1/\gamma},\; 10^{-12}\big)\) with the second term
MIN_FLOOR_FRACTION. That term wins below \(\gamma \approx 0.16\) at the default \(M = 100\); there the spread is \((1+\gamma)/(1-\gamma)\, 10^{12 \gamma}\), below \(M\) exactly when the clamp binds, somax_slope_ratiohas no effect on those cells. The clamp also guards the underflow below \(\gamma \approx 0.006\), where the formula’s fraction is 0 and \(a\), \(b\) would be infinite. Cells with \(\gamma = 0\) have \(s_f = 0\), \(a = 1\), \(b = 0\) and are exactly \(s / p_0\).Both
wherebranches receive a clipped input becausewhereevaluates both: the power branch would have an infinite derivative at 0, and the quadratic marginal price has a pole in the region where it is not selected. Money is clipped at zero first, so \(u(s) = 0\) for \(s < 0\), where the marginal price equals its value at zero and the average price isnan.Methods
Money the next delivered unit costs at
spend:p / (1 - gamma)above the floor.Average price of a delivered unit at
spend:spend / to_delivery(spend).Delivered units bought with
spend;u(0) == 0exactly.Attributes