spend.plot.average.transaction.value: Plot Actual vs. Expected Average Transaction Value

Description Usage Arguments Value See Also Examples

View source: R/spend.R

Description

Plots the actual and expected densities of average transaction values, and returns a vector with each customer's average transaction value probability.

Usage

1
2
3
4
5
6
7
8
spend.plot.average.transaction.value(
  params,
  m.x.vector,
  x.vector,
  xlab = "Average Transaction Value",
  ylab = "Marginal Distribution of Average Transaction Value",
  title = "Actual vs. Expected Average Transaction Value Across Customers"
)

Arguments

params

a 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).

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.

xlab

descriptive label for the x axis.

ylab

descriptive label for the y axis.

title

title placed on the top-center of the plot.

Value

a vector with the probability of each customer's average transaction value.

See Also

spend.marginal.likelihood

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
data(cdnowSummary)
ave.spend <- cdnowSummary$m.x
tot.trans <- cdnowSummary$cbs[,"x"]
# params <- c(6.25, 3.74, 15.44) # in original documentation. check below:
params <- spend.EstimateParameters(m.x.vector = ave.spend, x.vector = tot.trans)

# Plot the actual and expected average transaction value across customers.
f.m.x <- spend.plot.average.transaction.value(params, ave.spend, tot.trans)

## End(Not run)

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