Package index
Check the data
Find collinear, flat or dark channels and inconsistent costs before fitting anything.
-
diagnose_media() - Diagnose media data before modelling
-
plot(<mm_diagnosis>) - Plot media diagnostics
Carryover (adstock)
Spread each period’s media forward in time, and translate decay into a half-life.
-
adstock_geometric() - Geometric adstock
-
adstock_weibull() - Weibull adstock
-
adstock_weights_delayed()adstock_delayed() - Delayed adstock
-
adstock_filter() - Adstock with an arbitrary kernel
-
adstock_weights() - Geometric adstock weights
-
adstock_weights_weibull() - Weibull adstock weights
-
adstock_state() - Terminal adstock state
-
adstock_steady_state() - Steady-state starting value for an adstock filter
-
decay_from_half_life()half_life()effective_window() - Carryover decay vocabulary
Composing transforms
Apply carryover then saturation to one channel or to every channel of a plan, and convert Robyn’s hyperparameters to these arguments.
-
media_transform() - Adstock then saturate, in that order
-
transform_plan() - Transform every channel of a media plan
-
from_robyn() - Convert Robyn hyperparameters to mediamix arguments
Choosing carryover parameters
Score candidate decays and lags by how well a model predicts held-out KPI, with seasonality terms as controls.
-
tune_carryover() - Select carryover parameters by cross-validation against a KPI
-
tune_carryover_joint() - Tune every channel's carryover jointly, inside one model
-
plot(<mm_carryover>)plot(<mm_carryover_joint>) - Plot a carryover cross-validation profile
-
fit_ols()predict(<mm_ols>)coef(<mm_ols>)fitted(<mm_ols>)print(<mm_ols>) - Default linear fitter for carryover tuning
-
rmse()mae() - Root mean squared error and mean absolute error
-
fourier_terms()holiday_flags() - Seasonality controls for a model frame
Tuning with tidymodels
Recipe steps and tuning parameters for tuning carryover, saturation and a model penalty together.
-
step_adstock() - Adstock transformation as a recipe step
-
step_adstock_channels() - One adstock step per channel
-
step_saturation() - Saturation transformation as a recipe step
-
carryover_decay()carryover_max_lag()carryover_shape()carryover_scale()carryover_peak()saturation_half_max()saturation_shape() - Tuning parameters for media transforms
Contributions and return on investment
Turn a fitted model into channel contributions, average and marginal return, and response curves.
-
contributions() - Decompose predicted KPI into channel contributions
-
plot(<mm_contributions>) - Plot a contribution decomposition
-
roi()mroi() - Return on investment and marginal return
-
marginal_roi() - Average and marginal return by counterfactual simulation
-
response_curve()spend_for() - Response curve for a channel
-
plot(<mm_response_curve>) - Plot a response curve
-
block_bootstrap() - Moving block bootstrap for time-series statistics
-
plot(<mm_bootstrap>) - Plot bootstrap intervals
Budget planning
Simulate a plan through the fitted transforms, move budget between channels, and split a total budget across channels.
-
simulate_plan() - Predicted media response of a plan
-
reallocate() - Move spend between two channels of a plan
-
allocate_budget() - Allocate a budget across channels
-
plot(<mm_allocation>) - Plot a budget allocation
-
build_paths() - Build customer journeys from a raw event log
-
bind_paths()rbind(<mm_paths>) - Combine journey tables
-
`[`(<mm_paths>) - Subset a journey table
Journey diagnostics
Describe a journey table, including how long conversions take, before choosing a lookback or a credit rule.
-
path_summary() - Journey table summary
-
path_lengths() - Journey length distribution
-
channel_positions() - Where each channel sits in the journey
-
assisted_conversions() - Assisted conversion matrix
-
top_paths() - Most common journeys
-
conversion_lag() - Conversion lag distribution
-
path_diagnostics() - Run every journey diagnostic at once
Attribution
Credit conversions to channels by rule or by Markov removal effects, compare the rules, and export journeys to ChannelAttribution.
-
credit_linear()credit_first()credit_last()credit_position()credit_time_decay()credit_custom() - Assign conversion credit across a journey
-
markov_removal() - Markov-chain removal effects
-
attribute() - Attribute conversions to channels under several rules at once
-
attribution_spread() - Range of each channel's share across attribution rules
-
plot(<mm_attribution>) - Plot attribution shares across rules
-
plot(<mm_attribution_intervals>)plot(<mm_attribution_segments>) - Plot attribution shares with intervals or by segment
-
as_channel_paths() - Export journeys in ChannelAttribution's format
Example data
A simulated weekly media panel and event log, generated from known parameters so results can be checked.
-
mediamixmediamix-package - mediamix: media transforms and attribution path construction
-
mm_palette() - The package's chart palette