Learn R Programming

grizbayr (version 1.3.5)

sample_session_duration: Sample Session Duration

Description

Adds 2 new nested columns to the input_df: `gamma_params` and `samples` `gamma_params` in each row should be a tibble of length 2 (\(k\) and \(\theta\) parameters) `samples` in each row should be a tibble of length `n_samples`

Usage

sample_session_duration(input_df, priors, n_samples = 50000)

Value

input_df with 2 new nested columns `gamma_params` and `samples`

Arguments

input_df

Dataframe containing option_name (str), sum_sessions (dbl), and sum_duration (dbl).

priors

Optional list of priors k0 and theta0. Default \(Gamma(1, 250)\) will be use otherwise.

n_samples

Optional integer value. Defaults to 50,000 samples.

Details

See update_rules vignette for a mathematical representation. $$duration_i ~ Exponential(\lambda)$$ $$\lambda ~ Gamma(k, \theta)$$ Session Duration is sampled from a Gamma distribution with a Exponential likelihood of an individual leaving the site or ending a session at time t.

This is not always the case, so verify your data follows the shape of an exponential distribution before using this.