plot_adoption_curve#

pymc_marketing.bass.plotting.plot_adoption_curve(model, dim=None, coord=None, n_samples=10, hdi_probs=None, random_seed=None, subplot_kwargs=None, axes=None)[source]#

Plot the posterior adoption curve with the observed data.

Shows posterior samples and HDI of the adopters deterministic (new adopters per period) over time, with the observed counts in black.

Parameters:
modelBassModel

A fitted Bass model.

dimstr, optional

Dimension to facet over. Inferred from the fitted data when not given (the non-time, non-sample dimension).

coordstr, optional

Plot a single coordinate along dim. Default plots one subplot per coordinate.

n_samplesint, optional

Number of posterior sample curves to draw. Default is 10.

hdi_probsfloat or list of float, optional

HDI probabilities. Defaults to the ArviZ default (0.94).

random_seednp.random.Generator, optional

Random number generator for sample selection.

subplot_kwargsdict, optional

Additional kwargs for the subplot creation, e.g. figsize.

axesndarray of Axes, optional

Existing axes to plot on.

Returns:
tuple[Figure, ndarray of Axes]

Figure and the axes.

Examples

import numpy as np
from pymc_marketing.bass import BassModel

model = BassModel()
model.fit(data=adoption_counts)

fig, axes = model.plot_adoption_curve()