Learn R Programming

⚠️There's a newer version (1.2.0) of this package.Take me there.

BTYDplus

The BTYDplus R package provides advanced statistical methods to describe and predict customer's purchase behavior. It uses historic transaction records to fit a probabilistic model, which then allows to compute quantities of managerial interest on a cohort- as well as on a customer level (Customer Lifetime Value, Customer Equity, P(alive), etc.).

This package complements the BTYD package by providing several additional buy-till-you-die models, that have been published in the marketing literature, but whose implementation are complex and non-trivial. These models are: NBD, MBG/NBD, BG/CNBD-k, MBG/CNBD-k, Pareto/NBD (HB), Pareto/NBD (Abe) and Pareto/GGG.

Installation

# install.packages("devtools")
devtools::install_github("mplatzer/BTYDplus", dependencies=TRUE)
library(BTYDplus)

Getting Started

demo("cdnow")          # Demonstration of fitting various models to the CDNow data set
demo("mbg-cnbd-k")     # Demonstration of BG/CNBD-k model
demo("pareto-abe")     # Demonstration of Abe's Pareto/NBD variant
demo("pareto-ggg")     # Demonstration of Pareto/NBD (HB) & Pareto/GGG model

Contributions

We certainly welcome all feedback and contributions to this package! Please use GitHub Issues for filing bug reports and feature requests, and provide your contributions in the form of Pull Requests. See also these general guidelines to contribute to Open Source projects on GitHub.

Implemented Models

These R source files extend the functionality of the BTYD package by providing functions for parameter estimation and scoring for NBD, MBG/NBD, BG/CNBD-k, MBG/CNBD-k, Pareto/NBD (HB), Pareto/NBD (Abe) and Pareto/GGG.

  • NBD Ehrenberg, Asc. "The Pattern of Consumer Purchases." Quantitative techniques in marketing analysis: text and readings (1962): 355.
  • MBG/NBD Batislam, E.P., M. Denizel, A. Filiztekin. 2007. Empirical validation and comparison of models for customer base analysis. International Journal of Research in Marketing 24(3) 201–209.
  • (M)BG/CNBD-k Platzer, Michael, and Thomas Reutterer. forthcoming...
  • Pareto/NBD (HB) Ma, Shao-Hui, and Jin-Lan Liu. "The MCMC approach for solving the Pareto/NBD model and possible extensions." Natural Computation, 2007. ICNC 2007. Third International Conference on. Vol. 2. IEEE, 2007.
  • Pareto/NBD (Abe) Abe, Makoto. "Counting your customers one by one: A hierarchical Bayes extension to the Pareto/NBD model." Marketing Science 28.3 (2009): 541-553.
  • Pareto/GGG Platzer, Michael, and Thomas Reutterer. "Ticking Away the Moments: Timing Regularity Helps to Better Predict Customer Activity." Marketing Science (2016).

Copy Link

Version

Install

install.packages('BTYDplus')

Monthly Downloads

139

Version

0.7.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Michael Platzer

Last Published

January 21st, 2021

Functions in BTYDplus (0.7.2)

elog2cum

Aggregate Event Log to cumulative number of repeat transactions
abe.GenerateData

Simulate data according to Pareto/NBD (Abe) model assumptions
dc.check.model.params.safe

Check Model Parameters
mbgcnbd.cbs.LL

(M)BG/CNBD-k Log-Likelihood
mbgcnbd.PlotTrackingCum

(M)BG/CNBD-k Tracking Cumulative Transactions Plot
mbgcnbd.Expectation

(M)BG/CNBD-k Expectation
mbgcnbd.ConditionalExpectedTransactions

(M)BG/CNBD-k Conditional Expected Transactions
mbgcnbd.GenerateData

Simulate data according to (M)BG/CNBD-k model assumptions
mbgcnbd.PAlive

(M)BG/CNBD-k P(alive)
mbgcnbd.pmf

(M)BG/CNBD-k Probability Mass Function
mbgcnbd.ExpectedCumulativeTransactions

(M)BG/CNBD-k Expected Cumulative Transactions
mbgcnbd.EstimateParameters

(M)BG/CNBD-k Parameter Estimation
mbgcnbd.PlotFrequencyInCalibration

(M)BG/CNBD-k Plot Frequency in Calibration Period
mbgcnbd.PlotTrackingInc

(M)BG/CNBD-k Tracking Incremental Transactions Comparison
mcmc.ExpectedCumulativeTransactions

Expected Cumulative Transactions for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mcmc.PActive

Calculates P(active) based on drawn future transactions.
mcmc.PlotTrackingInc

Tracking Incremental Transactions Plot for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mcmc.pmf

Probability Mass Function for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mcmc.PlotTrackingCum

Tracking Cumulative Transactions Plot for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mcmc.PlotFrequencyInCalibration

Frequency in Calibration Period for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mcmc.plotPActiveDiagnostic

Draw diagnostic plot to inspect error in P(active).
mcmc.DrawFutureTransactions

Samples number of future transactions based on MCMC parameter draws
mcmc.setBurnin

(Re-)set burnin of MCMC chains.
mcmc.PAlive

Calculates P(alive) based on MCMC parameter draws
pggg.mcmc.DrawParameters

Pareto/GGG Parameter Draws
pnbd.GenerateData

Simulate data according to Pareto/NBD model assumptions
pnbd.mcmc.DrawParameters

Pareto/NBD (HB) Parameter Draws
nbd.cbs.LL

Calculate the log-likelihood of the NBD model
nbd.ConditionalExpectedTransactions

NBD Conditional Expected Transactions
nbd.GenerateData

Simulate data according to NBD model assumptions
nbd.LL

Calculate the log-likelihood of the NBD model
pggg.plotRegularityRateHeterogeneity

Pareto/GGG Plot Regularity Rate Heterogeneity
pggg.GenerateData

Simulate data according to Pareto/GGG model assumptions
nbd.EstimateParameters

Parameter Estimation for the NBD model
elog2inc

Aggregate Event Log to incremental number of repeat transactions
elog2cbs

Convernt Event Log to customer-level summary statistic.
dc.PlotTracking

Generic Method for Tracking Plots
cdnow.sample

CDNow Sample Data
abe.mcmc.DrawParameters

Pareto/NBD (Abe) Parameter Draws
estimateRegularity

Estimate Regularity in Intertransaction Timings
plotSampledTimingPatterns

Plot timing patterns of sampled customers.
bgcnbd.Expectation

BG/CNBD-k Expectation
bgcnbd.ExpectedCumulativeTransactions

BG/CNBD-k Expected Cumulative Transactions
bgcnbd.PAlive

BG/CNBD-k P(alive)
bgcnbd.cbs.LL

Calculate the log-likelihood of the BG/CNBD-k model
bgcnbd.EstimateParameters

Parameter Estimation for the BG/CNBD-k model
bgcnbd.ConditionalExpectedTransactions

BG/CNBD-k Conditional Expected Transactions
bgcnbd.LL

Calculate the log-likelihood of the BG/CNBD-k model
bgcnbd.GenerateData

Simulate data according to BG/CNBD-k model assumptions
bgcnbd.PlotFrequencyInCalibration

BG/CNBD-k Plot Frequency in Calibration Period
bgnbd.GenerateData

Simulate data according to BG/NBD model assumptions
bgcnbd.PlotTrackingInc

BG/CNBD-k Tracking Incremental Transactions Comparison
bgcnbd.PlotTrackingCum

BG/CNBD-k Tracking Cumulative Transactions Plot
bgcnbd.pmf

BG/CNBD-k Probability Mass Function
mbgcnbd.LL

Calculate the log-likelihood of the MBG/CNBD-k model
mbgnbd.EstimateParameters

Parameter Estimation for the MBG/NBD model
mbgnbd.GenerateData

Simulate data according to MBG/NBD model assumptions
mbgnbd.LL

Calculate the log-likelihood of the MBG/NBD model
mbgnbd.PAlive

MBG/NBD P(alive)
mbgnbd.cbs.LL

Calculate the log-likelihood of the MBG/NBD model
mbgnbd.ConditionalExpectedTransactions

MBG/NBD Conditional Expected Transactions
mcmc.Expectation

Unconditional Expectation for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)
mbgnbd.pmf

MBG/NBD Unconditional Probability Distribution of Transactions
ggnbd.PAlive

Gamma/Gompertz/NBD P(alive)
ggnbd.GenerateData

Simulate data according to Gamma/Gompertz/NBD model assumptions
ggnbd.EstimateParameters

Parameter Estimation for Gamma/Gompertz/NBD model
ggnbd.cbs.LL

Calculate the log-likelihood of the Gamma/Gompertz/NBD model
ggnbd.LL

Calculate the log-likelihood of the Gamma/Gompertz/NBD model
ggnbd.ConditionalExpectedTransactions

Gamma/Gompertz/NBD Conditional Expected Transactions
pggg.mcmc.plotRegularityRateHeterogeneity

Pareto/GGG Plot Regularity Rate Heterogeneity