sample_rev_per_session: Sample Rev Per Session

View source: R/sample_rev_per_session.R

sample_rev_per_sessionR Documentation

Sample Rev Per Session


Adds 3 new nested columns to the input_df: 'beta_params', 'gamma_params', and 'samples' 'beta_params' and 'gamma_params' in each row should be a tibble of length 2 (α and β parameters and k and θ parameters) 'samples' in each row should be a tibble of length 'n_samples'


sample_rev_per_session(input_df, priors, n_samples = 50000)



Dataframe containing option_name (str), sum_conversions (dbl), sum_revenue (dbl), and sum_clicks (dbl).


Optional list of priors alpha0, beta0 for Beta and k0, theta0 for Gamma. Default Beta(1,1) and Gamma(1, 250) will be use otherwise.


Optional integer value. Defaults to 50,000 samples.


See update_rules vignette for a mathematical representation.

RevPerSession = RevPerOrder * OrdersPerClick

This is a combination of a Beta-Bernoulli update and a Gamma-Exponential update.

conversion_i ~ Bernoulli(φ)

revenue_i ~ Exponential(λ)

φ ~ Beta(α, β)

λ ~ Gamma(k, θ)

revenue_i ~ Bernoulli(φ) * Exponential(λ)^-1)

Rev Per Session ~ φ / λ

Conversion Rate is sampled from a Beta distribution with a Binomial likelihood of an individual converting.

Average Rev Per Order is sampled from a Gamma distribution with an Exponential likelihood of Revenue from an individual order. This function makes sense to use if there is a distribution of possible revenue values that can be produced from a single order or conversion.


input_df with 3 new nested columns 'beta_params', 'gamma_params', and 'samples'

grizbayr documentation built on Aug. 16, 2022, 1:06 a.m.