add_lift_measurements_to_likelihood_from_saturation#

pymc_marketing.mmm.lift_test.add_lift_measurements_to_likelihood_from_saturation(df_lift_test, saturation, time_varying_var_name=None, model=None, dist=<class 'pymc.distributions.continuous.Gamma'>, name='lift_measurements', get_indices=<function exact_row_indices>, variable_indexer_factory=<function create_variable_indexer>)[source]#

Add lift measurements to the likelihood from a saturation transformation.

Wrapper around add_saturation_observations() to work with SaturationTransformation instances and time-varying variables.

Used internally of the MMM class.

Parameters:
df_lift_testpd.DataFrame
DataFrame with lift test results with at least the following columns:
  • x: x axis value of the lift test.

  • delta_x: change in x axis value of the lift test.

  • delta_y: change in y axis value of the lift test.

  • sigma: standard deviation of the lift test.

saturationSaturationTransformation

Any SaturationTransformation instance.

time_varying_var_namestr, optional

Name of the time-varying variable in model.

modelOptional[pm.Model], optional

PyMC model with arbitrary number of coordinates, by default None

distpm.Distribution class, optional

PyMC distribution to use for the likelihood, by default pm.Gamma

namestr, optional

Name of the likelihood, by default “lift_measurements”

get_indicesCallable[[pd.DataFrame, pm.Model], Indices], optional

Function to get the indices of the DataFrame in the model, by default exact_row_indices which assumes that the columns map exactly to the model coordinates.

variable_indexer_factoryCallable[[pm.Model, Indices], Callable[[str], TensorVariable]], optional

Function to create a variable indexer, by default create_variable_indexer which creates a function to index variables in the model. This is used determine the values of the parameters to evaluate the saturation function.