Learn R Programming

BTYDplus (version 0.7.0)

nbd.EstimateParameters: Parameter Estimation for the NBD model

Description

Estimates parameters for the NBD model via Maximum Likelihood Estimation.

Usage

nbd.EstimateParameters(cal.cbs, par.start = c(1, 1),
  max.param.value = 10000)

Arguments

cal.cbs

calibration period CBS. It must contain columns for frequency x and total time observed T.cal. Optionally a column custs can be provided, which represents number of customers with a specific combination of frequency x and T.cal.

par.start

initial NBD parameters - a vector with r and alpha in that order.

max.param.value

the upper bound on parameters

Value

list of estimated parameters

References

EHRENBERG, ASC. 'The Pattern of Consumer Purchases.' Quantitative techniques in marketing analysis: text and readings (1962): 355.

Examples

Run this code
# NOT RUN {
set.seed(1)

# generate artificial NBD data
n <- 1000  # no. of customers
T.cal <- 32  # length of calibration period
T.star <- 32  # length of hold-out period
params <- c(r = 0.85, alpha = 4.45)  # purchase frequency lambda_i ~ Gamma(r, alpha)

cbs <- nbd.GenerateData(n, T.cal, T.star, params)$cbs

# estimate parameters, and compare to true parameters
est <- nbd.EstimateParameters(cbs[, c("x", "T.cal")])
rbind(params, est = round(est, 2))
# r alpha params 0.85 4.45 est 0.84 4.56 -> underlying parameters are successfully identified via Maximum
# Likelihood Estimation

# estimate future transactions in holdout-period
cbs$x.est <- nbd.ConditionalExpectedTransactions(est, cbs$T.star, cbs$x, cbs$T.cal)

# compare forecast accuracy to naive forecast
c(nbd = sqrt(mean((cbs$x.star - cbs$x.est)^2)), naive = sqrt(mean((cbs$x.star - cbs$x)^2)))
# nbd naive 3.446776 3.469582 -> NBD forecast only marginally better than naive forecast 
# }

Run the code above in your browser using DataLab