R/f_s3generics_clvdata.R
, R/f_s3generics_clvdata_dynamiccov.R
, R/f_s3generics_clvdata_staticcov.R
summary.clv.data.Rd
Summary method for objects of class clv.data
that provides information about the estimation and
possible holdout sample, and descriptive statistics of the transaction data.
# S3 method for class 'clv.data'
summary(object, ids = NULL, ...)
# S3 method for class 'summary.clv.data'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'clv.data.dynamic.covariates'
summary(object, ...)
# S3 method for class 'summary.clv.data.dynamic.covariates'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'clv.data.static.covariates'
summary(object, ...)
# S3 method for class 'summary.clv.data.static.covariates'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
A CLV data object containing transactional data and potentially also contextual factors.
A character vector of customer ids for which the transaction data is summarized. Defaults to
NULL
for all customers.
Ignored
An object of class "summary.clv.data"
, usually, a result of a call to summary.clv.data
.
The number of significant digits to use when printing.
This function computes and returns summary statistics of the
transactional and covariates data given in object
. This is a list of
class summary.clv.data
and contains the elements:
Human readable description of the type of data.
Summary information about the stored clv.time
object.
A data.table
with summary statistics of
the transactions overall and in the estimation and holdout sample.
Ids for which the transaction data was summarized. NULL
if all Ids were used.
For static covariates data, the list additionally is of class summary.clv.data.static.covariates
and further contains the elements:
Names of the covariates for the Transaction process.
Names of the covariates for the Lifetime process.
If applicable, the summary statistics are provided separately for the estimation and holdout period as well as
for the overall time period (estimation + holdout). By using the ids
argument, the summary statistics can
be limited to a subset of customers.
Number of customers
Count of individual customers.
First Transaction in period
Time point of the first transaction occurring in the indicated period.
Last Transaction in period
Time point of the last transaction occurring in the indicated period.
Total # Transactions
Count of transactions occurring in the indicated period.
Mean # Transactions per cust
Average transactions per customer in the indicated period, including standard deviation (SD).
Mean Spending per Transaction
Average spending per customer in the indicated period, including standard deviation (SD). Spending statistics are only available if spending data was provided when creating the object.
Total Spending
Sum of customer spending during the indicated period.
Total # zero repeaters
Number of customers who purchased only once during the estimation period.
Percentage of zero repeaters
Percentage of customers who purchased only once during the estimation period.
Mean Interpurchase time
Average time (in number of periods) between two transactions of the same customer, including standard deviation (SD).
plot
for how to plot a clv data object
clvdata
for how to create a clv data object
SetStaticCovariates
for how to add static covariates
SetDynamicCovariates
for how to add dynamic covariates
# \donttest{
data("apparelTrans")
clv.data.apparel <- clvdata(apparelTrans, date.format = "ymd",
time.unit = "w",
estimation.split = 40)
# summary of transaction data and split
summary(clv.data.apparel)
#> CLV Transaction Data
#>
#> Time unit Weeks
#> Estimation length 40.0000 Weeks
#> Holdout length 39.71429 Weeks
#>
#> Transaction Data Summary
#> Estimation Holdout Total
#> Number of customers - - 250
#> First Transaction in period 2005-01-03 2005-10-11 2005-01-03
#> Last Transaction in period 2005-10-10 2006-07-16 2006-07-16
#> Total # Transactions 1311 946 2257
#> Mean # Transactions per cust 5.244 8.226 9.028
#> (SD) 6.082 8.934 12.603
#> Mean Spending per Transaction 39.436 38.519 39.051
#> (SD) 42.649 59.723 50.503
#> Total Spending 51700.490 36438.640 88139.130
#> Total # zero repeaters 77 - -
#> Percentage of zero repeaters 30.800 - -
#> Mean Interpurchase time 7.361 5.756 9.462
#> (SD) 6.791 6.394 12.266
#>
# transaction summary of customer "1219"
summary(clv.data.apparel, ids="1219")
#> Transaction Data Summary for Given Customers (n=1)
#> Estimation Holdout Total
#> Number of customers - - 1
#> First Transaction in period 2005-01-03 2005-10-29 2005-01-03
#> Last Transaction in period 2005-09-08 2006-05-07 2006-05-07
#> Total # Transactions 5 14 19
#> Mean # Transactions per cust 5.000 14.000 19.000
#> (SD) - - -
#> Mean Spending per Transaction 20.544 29.554 27.183
#> (SD) 9.793 13.722 13.188
#> Total Spending 102.720 413.760 516.480
#> Total # zero repeaters 0 - -
#> Percentage of zero repeaters 0.000 - -
#> Mean Interpurchase time 8.857 2.088 3.881
#> (SD) - - -
#>
# transaction summary of customers "1", "10", "100", and "1000"
summary(clv.data.apparel, ids=c("1", "10", "100", "1000"))
#> Transaction Data Summary for Given Customers (n=4)
#> Estimation Holdout Total
#> Number of customers - - 4
#> First Transaction in period 2005-01-03 2005-10-16 2005-01-03
#> Last Transaction in period 2005-10-07 2006-07-15 2006-07-15
#> Total # Transactions 40 46 86
#> Mean # Transactions per cust 10.000 23.000 21.500
#> (SD) 9.309 0.000 22.546
#> Mean Spending per Transaction 51.193 39.292 44.827
#> (SD) 52.527 34.108 43.789
#> Total Spending 2047.700 1807.440 3855.140
#> Total # zero repeaters 1 - -
#> Percentage of zero repeaters 25.000 - -
#> Mean Interpurchase time 3.676 1.727 3.515
#> (SD) 2.519 0.0551 2.647
#>
# add contextual factors
data("apparelStaticCov")
clv.data.apparel.cov <-
SetStaticCovariates(clv.data.apparel,
data.cov.life = apparelStaticCov,
names.cov.life = "Gender",
data.cov.trans = apparelStaticCov,
names.cov.trans = "Gender")
# additional info about the covariates
summary(clv.data.apparel.cov)
#> CLV Transaction Data with Static Covariates
#>
#> Time unit Weeks
#> Estimation length 40.0000 Weeks
#> Holdout length 39.71429 Weeks
#>
#> Transaction Data Summary
#> Estimation Holdout Total
#> Number of customers - - 250
#> First Transaction in period 2005-01-03 2005-10-11 2005-01-03
#> Last Transaction in period 2005-10-10 2006-07-16 2006-07-16
#> Total # Transactions 1311 946 2257
#> Mean # Transactions per cust 5.244 8.226 9.028
#> (SD) 6.082 8.934 12.603
#> Mean Spending per Transaction 39.436 38.519 39.051
#> (SD) 42.649 59.723 50.503
#> Total Spending 51700.490 36438.640 88139.130
#> Total # zero repeaters 77 - -
#> Percentage of zero repeaters 30.800 - -
#> Mean Interpurchase time 7.361 5.756 9.462
#> (SD) 6.791 6.394 12.266
#>
#> Covariates
#> Trans. Covariates Gender
#> # covs 1
#> Life. Covariates Gender
#> # covs 1
#>
# }