MMM.add_lift_test#
- MMM.add_lift_test(experiment, channel, x, delta_x, dist=<class 'pymc.distributions.continuous.Gamma'>, name='lift_measurements', **dim_kwargs)[source]#
Add a CausalPy experiment result as a lift test calibration.
Convenience method that converts an
ExperimentResultinto the lift test DataFrame format and passes it toadd_lift_test_measurements().- Parameters:
- experiment
ExperimentResult The experiment result from
experiment()orrun_experiment().- channel
str The marketing channel name. Must be present in
channel_columns.- x
float The baseline spend level for the channel during the experiment.
- delta_x
float The change in channel spend during the experiment.
- disttype[
pm.Distribution], optional The distribution to use for the likelihood, by default
pm.Gamma.- name
str, optional The name of the likelihood contribution, by default
"lift_measurements".- **dim_kwargs
str Dimension values for the lift test, e.g.
geo="US". Keys must match the model’sdims.
- experiment
- Raises:
RuntimeErrorIf the model has not been built yet.
KeyErrorIf the channel or dimension values don’t match the model.
See also
experimentRun a CausalPy experiment.
add_lift_test_measurementsAdd raw lift test measurements.
Examples
import causalpy as cp result = mmm.experiment( experiment_type="its", data=df_experiment, treatment_time=pd.Timestamp("2024-01-01"), formula="y ~ 1 + t", model=cp.pymc_models.LinearRegression(), ) mmm.add_lift_test( experiment=result, channel="tv", x=1000.0, delta_x=200.0, geo="US", )