Description Usage Arguments Details Value Examples
Efficient implementation for the conversion of an event log into a
customer-by-sufficient-statistic (CBS) data.frame
, with a row for each
customer, which is the required data format for estimating model parameters.
1 |
elog |
Event log, a |
units |
Time unit, either |
T.cal |
End date of calibration period. Defaults to
|
T.tot |
End date of the observation period. Defaults to
|
The time unit for expressing t.x
, T.cal
and litt
are
determined via the argument units
, which is passed forward to method
difftime
, and defaults to weeks
.
Argument T.tot
allows one to specify the end of the observation period,
i.e. the last possible date of an event to still be included in the event
log. If T.tot
is not provided, then the date of the last recorded event
will be assumed to coincide with the end of the observation period. If
T.tot
is provided, then any event that occurs after that date is discarded.
Argument T.cal
allows one to split the summary statistics into a
calibration and a holdout period. This can be useful for evaluating
forecasting accuracy for a given dataset. If T.cal
is not provided,
then the whole observation period is considered, and is then subsequently
used for for estimating model parameters. If it is provided, then the
returned data.frame
contains two additional fields, with x.star
representing the number of repeat transactions during the holdout period of
length T.star
. And only those customers are contained, who have had at
least one event during the calibration period.
Transactions with identical cust
and date
field are treated as
a single transaction, with sales
being summed up.
data.frame
with fields:
|
Customer id (unique key). |
|
Number of recurring events in calibration period. |
|
Time between first and last event in calibration period. |
|
Sum of logarithmic intertransaction timings during calibration period. |
|
Sum of sales in calibration period, incl. initial transaction. Only if |
|
Sum of sales in calibration period, excl. initial transaction. Only if |
|
Date of first transaction in calibration period. |
|
Time between first event and end of calibration period. |
|
Length of holdout period. Only if |
|
Number of events within holdout period. Only if |
|
Sum of sales within holdout period. Only if |
1 2 3 | data("groceryElog")
cbs <- elog2cbs(groceryElog, T.cal = "2006-12-31", T.tot = "2007-12-30")
head(cbs)
|
cust x t.x litt first T.cal T.star x.star
1 1 0 0.00000 0.000000 2006-01-01 52.00000 52 0
2 2 1 50.28571 3.917721 2006-01-01 52.00000 52 0
3 3 19 48.57143 16.952179 2006-01-01 52.00000 52 14
4 4 0 0.00000 0.000000 2006-01-01 52.00000 52 0
5 5 2 40.42857 6.012667 2006-01-01 52.00000 52 3
6 6 5 47.57143 11.178735 2006-01-02 51.85714 52 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.