LogSaturation#

class pymc_marketing.mmm.components.saturation.LogSaturation(priors=None, prefix=None)[source]#

Logarithmic saturation for log-log models.

Applies \(\beta \, \log(1 + x)\), mapping spend through a concave logarithmic curve with diminishing returns. When combined with link="log" in the MMM, the coefficient \(\beta\) has an elasticity-like interpretation.

(Source code, png, hires.png, pdf)

../../_images/pymc_marketing-mmm-components-saturation-LogSaturation-1.png

Methods

LogSaturation.__init__([priors, prefix])

LogSaturation.apply(x, *[, dims, core_dim, idx])

Call within a model context.

LogSaturation.from_dict(data)

Reconstruct a saturation transformation from a dict.

LogSaturation.function(x, beta, *[, dim])

Logarithmic saturation function: beta * log(1 + x).

LogSaturation.plot_curve(curve[, n_samples, ...])

Plot curve HDI and samples.

LogSaturation.plot_curve_hdi(curve[, ...])

Plot the HDI of the curve.

LogSaturation.plot_curve_samples(curve[, n, ...])

Plot samples from the curve.

LogSaturation.sample_curve([parameters, ...])

Sample the curve of the saturation transformation given parameters.

LogSaturation.sample_prior([coords])

Sample the priors for the transformation.

LogSaturation.set_dims_for_all_priors(dims)

Set the dims for all priors.

LogSaturation.to_dict([_orig])

Convert the transformation to a dictionary.

LogSaturation.update_priors(priors)

Update the priors for a function after initialization.

LogSaturation.with_default_prior_dims(dims)

Return a copy with default prior dims (dims=None) set to dims instead.

LogSaturation.with_updated_priors(priors)

Return a copy with updated priors.

Attributes

combined_dims

Get the combined dims for all the parameters.

default_priors

function_priors

Get the priors for the function.

model_config

Mapping from variable name to prior for the model.

prefix

priors

Get the priors for the function.

variable_mapping

Mapping from parameter name to variable name in the model.