Calculate P(X(t)=x), the probability to make exactly x repeat transactions in the interval (0, t]. This interval is in the estimation period and excludes values of t=0. Note that here t is defined as the observation period T.cal which differs by customer.

# S4 method for class 'clv.fitted.transactions'
pmf(object, x = 0:5)

Arguments

object

The fitted transaction model.

x

Vector of positive integer numbers (>=0) indicating the number of repeat transactions x for which the PMF should be calculated.

Value

Returns a data.table with ids and depending on x, multiple columns of PMF values, each column for one value in x.

Id

customer identification

pmf.x.Y

PMF values for Y number of transactions

See also

The model fitting functions pnbd, bgnbd, ggomnbd.

plot to visually compare the PMF values against actuals.

Examples

# \donttest{
data("cdnow")

# Fit the ParetoNBD model on the CDnow data
pnbd.cdnow <- pnbd(clvdata(cdnow, time.unit="w",
                           estimation.split=37,
                           date.format="ymd"))
#> Starting estimation...
#> Estimation finished!

# Calculate the PMF for 0 to 10 transactions
#  in the estimation period
pmf(pnbd.cdnow, x=0:10)
#> Key: <Id>
#>           Id   pmf.x.0   pmf.x.1    pmf.x.2    pmf.x.3    pmf.x.4    pmf.x.5
#>       <char>     <num>     <num>      <num>      <num>      <num>      <num>
#>    1:      1 0.6015867 0.1657126 0.08154981 0.04791521 0.03063585 0.02056155
#>    2:     10 0.6015867 0.1657126 0.08154981 0.04791521 0.03063585 0.02056155
#>    3:    100 0.6027305 0.1659498 0.08154193 0.04780985 0.03049355 0.02041124
#>    4:   1000 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#>    5:   1001 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#>   ---                                                                       
#> 2353:    995 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#> 2354:    996 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#> 2355:    997 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#> 2356:    998 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#> 2357:    999 0.6134959 0.1679538 0.08124694 0.04665213 0.02904922 0.01894526
#>          pmf.x.6     pmf.x.7     pmf.x.8     pmf.x.9    pmf.x.10
#>            <num>       <num>       <num>       <num>       <num>
#>    1: 0.01423487 0.010067187 0.007230395 0.005253625 0.003851874
#>    2: 0.01423487 0.010067187 0.007230395 0.005253625 0.003851874
#>    3: 0.01409079 0.009935960 0.007114564 0.005153510 0.003766630
#>    4: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#>    5: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#>   ---                                                           
#> 2353: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#> 2354: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#> 2355: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#> 2356: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596
#> 2357: 0.01272574 0.008722852 0.006067269 0.004266924 0.003026596

# Compare vs. actuals (CBS in estimation period):
# x    mean(pmf)    actual percentage of x
# 0    0.616514     1432/2357= 0.6075519
# 1    0.168309     436/2357 = 0.1849809
# 2    0.080971     208/2357 = 0.0882478
# 3    0.046190     100/2357 = 0.0424268
# 4    0.028566     60/2357  = 0.0254561
# 5    0.018506     36/2357  = 0.0152737
# 6    0.012351     27/2357  = 0.0114552
# 7    0.008415     21/2357  = 0.0089096
# 8    0.005822     5/2357   = 0.0021213
# 9    0.004074     4/2357   = 0.0016971
# 10   0.002877     7/2357   = 0.0029699
# }