create_bass_model#
- pymc_marketing.bass.model.create_bass_model(t, observed, priors, coords, model=None)[source]#
Define a Bass diffusion model for product adoption forecasting.
This function creates a Bayesian Bass diffusion model using PyMC to forecast product adoption over time. The Bass model captures both innovation (external influence like advertising) and imitation (internal influence like word-of-mouth) effects in the adoption process.
The model includes the following components:
Market potential ‘m’: Total number of eventual adopters
Innovation coefficient ‘p’: Measures external influence
Imitation coefficient ‘q’: Measures internal influence
Adopters over time: Number of new adopters at each time point
Innovators: Adopters influenced by external factors
Imitators: Adopters influenced by previous adopters
Peak adoption time: When adoption rate reaches maximum
- Parameters:
- t
pt.TensorLike Time points for which the adoption is modeled.
- observed
pt.TensorLikeorxr.DataArrayorNone Observed adoption data at each time point. If None, only prior predictive sampling is possible. Axis labels are read from the data itself (an
xr.DataArray) or from the model (apm.Dataregistered with dims); anything else, such as a plain array or apm.Datawithout dims, is labelled positionally in(T, ...)order with the extra dims following their first appearance across thep,q,mandlikelihoodpriors, in that order.- priors
BassPriors Dictionary containing priors for: - ‘m’: Market potential prior - ‘p’: Innovation coefficient prior - ‘q’: Imitation coefficient prior - ‘likelihood’: Observation likelihood model
- coords
dict[str,Any] Coordinate values for dimensions in the model, including ‘date’ for the time dimension and any other dimensions included in the prior specifications.
- model
Model, optional An existing PyMC model to use. If not provided, a new model is created with the given coords.
- t
- Returns:
ModelA PyMC model object for the Bass diffusion model, containing the variables m, p, q, adopters, innovators, imitators, peak, and the likelihood y.
Notes
The returned model can be used for prior predictive checks, posterior sampling, and posterior predictive checks to forecast product adoption.
The model implements the following mathematical relationships:
\[\begin{split}\text{adopters}(t) &= m \cdot f(p, q, t) \\ \text{innovators}(t) &= m \cdot p \cdot (1 - F(p, q, t)) \\ \text{imitators}(t) &= m \cdot q \cdot F(p, q, t) \cdot (1 - F(p, q, t)) \\ \text{peak} &= \frac{\ln(q) - \ln(p)}{p + q}\end{split}\]