spend.EstimateParameters: Spend Parameter Estimation

Description Usage Arguments Details Value Examples

View source: R/spend.R

Description

Estimates parameters for the gamma-gamma spend model.

Usage

1
2
3
4
5
6
spend.EstimateParameters(
  m.x.vector,
  x.vector,
  par.start = c(1, 1, 1),
  max.param.value = 10000
)

Arguments

m.x.vector

a vector with each customer's average observed transaction value in the calibration period.

x.vector

a vector with the number of transactions each customer made in the calibration period. Must correspond to m.x.vector in terms of ordering of customers and length of the vector.

par.start

initial vector of gamma-gamma parameters: p, q, and gamma, in that order. p is the shape parameter for each transaction. The scale parameter for each transaction is distributed across customers according to a gamma distribution with parameters q (shape) and gamma (scale).

max.param.value

the upper bound on parameters.

Details

The best-fitting parameters are determined using the spend.LL function. The sum of the log-likelihood for each customer (for a set of parameters) is maximized in order to estimate parameters.

A set of starting parameters must be provided for this method. If no parameters are provided, (1,1,1,1) is used as a default. It may be necessary to run the estimation from multiple starting points to ensure that it converges. To compare the log-likelihoods of different parameters, use spend.LL.

The lower bound on the parameters to be estimated is always zero, since gamma-gamma parameters cannot be negative. The upper bound can be set with the max.param.value parameter.

Value

Vector of estimated parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
data(cdnowSummary)
ave.spend <- cdnowSummary$m.x
tot.trans <- cdnowSummary$cbs[,"x"]

# There will be many warnings due to the zeroes that are
# included in the data above. To avoid them, use the following:
# (see example for spend.LL)

ave.spend <- ave.spend[which(tot.trans > 0)]
tot.trans <- tot.trans[which(tot.trans > 0)]

# We will let the spend function use default starting parameters
spend.EstimateParameters(ave.spend, tot.trans)

## End(Not run)

BTYD documentation built on Nov. 18, 2021, 1:10 a.m.