hill_function#
- pymc_marketing.mmm.transformers.hill_function(x, slope, kappa)[source]#
Hill Function.
\[f(x) = 1 - \frac{\kappa^s}{\kappa^s + x^s}\]- where:
\(s\) is the slope of the hill, which sets how steeply the curve rises around \(\kappa\).
\(\kappa\) is the half-saturation point as \(f(\kappa) = 0.5\) for any value of \(s\).
\(x\) is the independent variable and must be non-negative.
Hill function from Equation (5) in the paper [1].
The slope alone decides the shape of the curve. For \(s \le 1\) it is concave everywhere, with \(s = 1\) giving the Michaelis-Menten curve. For \(s > 1\) it is S-shaped: convex at small \(x\), then concave, with a single inflection point at
\[x^* = \kappa \left(\frac{s - 1}{s + 1}\right)^{1/s}, \qquad f(x^*) = \frac{s - 1}{2s}.\]The inflection point always sits below \(\kappa\) and moves toward it as \(s\) grows. Since \(f\) depends on \(x\) only through \(x / \kappa\), changing \(\kappa\) stretches the curve horizontally without changing its shape. Whether an S-shape is visible in data depends on both parameters: when \(x^*\) lies close to zero or beyond the observed range of \(x\), the data cannot tell the curve apart from a purely concave or purely convex one.
The slope is easiest to read at the half-saturation point, where the gradient is \(f'(\kappa) = s / (4 \kappa)\). Measured in units of \(\kappa\), the curve rises at a rate of \(s / 4\) as it passes the halfway mark. Equivalently, \(\operatorname{logit} f(x) = s (\log x - \log \kappa)\), so \(s\) is the constant slope of the curve on logit-log axes.
The grid below shows how the two parameters interact on the unit interval. The dashed line marks \(\kappa\) and the dot marks the inflection point \(x^*\) when it falls inside the plotted range.
(
Source code,png,hires.png,pdf)
- Parameters:
x (
Union[Variable,Sequence[Variable], ArrayLike,XTensorVariable,DataArray]) – The independent variable, typically representing the concentration of a substrate or the intensity of a stimulus.slope (
Union[Variable,Sequence[Variable], ArrayLike,XTensorVariable,DataArray]) – Steepness of the curve as it passes the half-saturation point: the gradient at \(x = \kappa\) is \(s / (4 \kappa)\). Values above 1 give an S-shaped curve. Must be non-negative.kappa (
Union[Variable,Sequence[Variable], ArrayLike,XTensorVariable,DataArray]) – The half-saturation point as \(f(\kappa) = 0.5\) for any value of \(s\).
- Return type:
- Returns:
The value of the Hill function given the parameters.
References
[1]Jin, Yuxue, et al. “Bayesian methods for media mix modeling with carryover and shape effects.” (2017).