Learn R Programming

BTYDplus (version 0.6.0)

estimateRegularity: Estimate Regularity in Intertransaction Timings

Description

Estimates degree of regularity of intertransaction timings of a customer cohort,

Usage

estimateRegularity(elog, method = "wheat", plot = FALSE)

Arguments

elog

data.frame with transaction logs; requires columns customer-id 'cust' and transaction time t or 'date'

method

wheat, mle, mle-minka, mle-thom, cv

plot

if TRUE then distribution of estimated regularity will be plotted

Value

estimated real-valued regularity parameter; rounded to an integer, this can be used as k for estimating MBG/CNBD-k models

Details

This is done - by either assuming same regularity across all customers; this then only require three transactions per customer method: wheat - or by estimating regularity for each customer seperately (as the shape parameter of a fitted gamma distribution), and then return the median across estimates; this requires min. 10 transactions per customer methods: mle, mle-minka, mle-thom, cv

See Also

mbgcnbd.EstimateParameters

Examples

Run this code
# NOT RUN {
require(data.table)

# generate Erlang-3 with various lambdas
nr_of_customers <- 100
elog <- rbindlist(lapply(1:nr_of_customers, function(i) {
  k <- 3
  lambda <- exp(rnorm(1))
  data.table(cust=i, t=cumsum(rgamma(20, k, k*lambda)))
}))

# estimate regularity parameter k
estimateRegularity(elog, plot=TRUE, method='wheat')
estimateRegularity(elog, plot=TRUE, method='mle-minka')
estimateRegularity(elog, plot=TRUE, method='mle-thom')
estimateRegularity(elog, plot=TRUE, method='cv')
# }

Run the code above in your browser using DataLab