MMM.plot_new_spend_contributions#

MMM.plot_new_spend_contributions(spend_amount, one_time=True, lower=0.025, upper=0.975, ylabel='Sales', idx=None, channels=None, prior=False, original_scale=True, ax=None, **sample_posterior_predictive_kwargs)[source]#

Plot the upcoming sales for a given spend amount.

Calls the new_spend_contributions method and plots the results. For more control over the plot, use new_spend_contributions directly.

Parameters:
spend_amountfloat

The amount of spend for each channel

one_timebool, optional

Whether the spend are one time (at start of period) or constant (over period), by default True (one time)

lowerfloat, optional

The lower quantile for the confidence interval, by default 0.025

upperfloat, optional

The upper quantile for the confidence interval, by default 0.975

ylabelstr, optional

The label for the y-axis, by default “Sales”

idxslice, optional

The index slice of days to plot, by default None or only the positive days. More specifically, slice(0, None, None)

channelsList[str], optional

The channels to plot, by default None or all channels

priorbool, optional

Whether to use the prior or posterior, by default False (posterior)

original_scalebool, optional

Whether to plot in the original scale of the target variable, by default True

axplt.Axes, optional

The axes to plot on, by default None or current axes

**sample_posterior_predictive_kwargs

Additional keyword arguments passed to pm.sample_posterior_predictive

Returns:
plt.Axes

The plot of upcoming sales for the given spend amount