# bgbb.PAlive: BG/BB P(Alive) In BTYD: Implementing BTYD Models with the Log Sum Exp Patch

## Description

Uses BG/BB model parameters and a customer's past transaction behavior to return the probability that they will be alive in the transaction opportunity following the calibration period.

## Usage

 `1` ```bgbb.PAlive(params, x, t.x, n.cal) ```

## Arguments

 `params` BG/BB parameters - a vector with alpha, beta, gamma, and delta, in that order. Alpha and beta are unobserved parameters for the beta-Bernoulli transaction process. Gamma and delta are unobserved parameters for the beta-geometric dropout process. `x` the number of repeat transactions made by the customer in the calibration period. Can also be vector of frequencies - see details. `t.x` recency - the transaction opportunity in which the customer made their last transaction. Can also be a vector of recencies - see details. `n.cal` number of transaction opportunities in the calibration period. Can also be a vector of calibration period transaction opportunities - see details.

## Details

`x`, `t.x`, and `n.cal` may be vectors. The standard rules for vector operations apply - if they are not of the same length, shorter vectors will be recycled (start over at the first element) until they are as long as the longest vector. It is advisable to keep vectors to the same length and to use single values for parameters that are to be the same for all calculations. If one of these parameters has a length greater than one, the output will be a vector of probabilities.

P(alive at n+1 | alpha, beta, gamma, delta, x, t.x, n)

## Value

Probability that the customer is alive at the (n+1)th transaction opportunity. If `x`, `t.x`, and/or `n.cal` are of length greater than one, then this will be a vector of probabilities (containing one element matching each element of the longest input vector).

## References

Fader, Peter S., Bruce G.S. Hardie, and Jen Shang. "Customer-Base Analysis in a Discrete-Time Noncontractual Setting." Marketing Science 29(6), pp. 1086-1108. 2010. INFORMS. Web.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```params <- c(1.20, 0.75, 0.66, 2.78) # The probability that a customer who made 3 transactions in # the calibration period (which consisted of 6 transaction # opportunities), with the last transaction occurring at the # 4th transaction opportunity, is alive at the 7th transaction # opportunity bgbb.PAlive(params, x=3, t.x=4, n.cal=6) # The input parameters may also be vectors: bgbb.PAlive(params, x=1, t.x=1:6, n.cal=6) ```

### Example output

```Loading required package: hypergeo
[1] 0.4383439
[1] 0.06918809 0.25379563 0.48008913 0.67924778 0.82738630 0.93008475
```

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