Learn R Programming

BTYD (version 2.4.3)

spend.generalParams: Define general parameters

Description

This is to ensure consistency across all spend functions.

Usage

spend.generalParams(params, func, m.x, x)

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

func

name of the function calling dc.InputCheck.

m.x

the customer's average observed transaction value in the calibration period. May also be a vector of average observed transaction values - see details.

x

the number of transactions the customer made in the calibration period. May also be a vector of frequencies - see details.

Value

That depends on func: 1. If func is spend.marginal.likelihood, the marginal distribution of a customer's average transaction value (if m.x or x has a length greater than 1, a vector of marginal likelihoods will be returned). 2. If func is spend.LL, the log-likelihood of the gamma-gamma model; if m.x or x has a length greater than 1, this is a vector of log-likelihoods. 3. If func is spend.expected.value, the expected transaction value for a customer conditional on their transaction behavior during the calibration period. If m.x or x has a length greater than one, then a vector of expected transaction values will be returned.

Details

This function is only ever called by functions defined in the original BTYD package, such as spend.LL, spend.marginal.likelihood or spend.expected.value so it returns directly the output that is expected from those calling functions.

See Also

spend.LL

spend.marginal.likelihood