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 = 52)
# summary of transaction data and split
summary(clv.data.apparel)
#> CLV Transaction Data
#>
#> Time unit Weeks
#> Estimation length 52.0000 Weeks
#> Holdout length 259.0000 Weeks
#>
#> Transaction Data Summary
#> Estimation Holdout Total
#> Number of customers - - 600
#> First Transaction in period 2005-01-02 2006-01-02 2005-01-02
#> Last Transaction in period 2006-01-01 2010-12-20 2010-12-20
#> Total # Transactions 1361 1822 3183
#> Mean # Transactions per cust 2.268 5.974 5.305
#> (SD) 1.695 5.908 6.119
#> Mean Spending per Transaction 40.908 37.695 39.069
#> (SD) 81.384 52.734 66.519
#> Total Spending 55676.140 68680.760 124356.900
#> Total # zero repeaters 259 - -
#> Percentage of zero repeaters 43.167 - -
#> Mean Interpurchase time 18.193 32.619 37.817
#> (SD) 12.568 27.034 42.339
#>
# transaction summary of customer "1219"
summary(clv.data.apparel, ids="1219")
#> Warning: no non-missing arguments to min; returning Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: Not all given ids were found in the transaction data.
#> Warning: no non-missing arguments to min; returning Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Transaction Data Summary for Given Customers (n=1)
#> Estimation Holdout Total
#> Number of customers - - 0
#> First Transaction in period Inf - Inf
#> Last Transaction in period -Inf - -Inf
#> Total # Transactions 0 - 0
#> Mean # Transactions per cust NaN - NaN
#> (SD) - - -
#> Mean Spending per Transaction NaN - NaN
#> (SD) - - -
#> Total Spending 0.000 - 0.000
#> Total # zero repeaters 0 - -
#> Percentage of zero repeaters NaN - -
#> Mean Interpurchase time - - -
#> (SD) - - -
#>
# transaction summary of customers "1", "10", "100", and "1000"
summary(clv.data.apparel, ids=c("1", "10", "100", "1000"))
#> Warning: Not all given ids were found in the transaction data.
#> Transaction Data Summary for Given Customers (n=4)
#> Estimation Holdout Total
#> Number of customers - - 3
#> First Transaction in period 2005-01-02 2006-01-18 2005-01-02
#> Last Transaction in period 2005-09-06 2010-06-08 2010-06-08
#> Total # Transactions 5 16 21
#> Mean # Transactions per cust 1.667 5.333 7.000
#> (SD) 0.577 3.512 3.000
#> Mean Spending per Transaction 84.110 57.547 63.872
#> (SD) 85.548 63.964 68.313
#> Total Spending 420.550 920.760 1341.310
#> Total # zero repeaters 1 - -
#> Percentage of zero repeaters 33.333 - -
#> Mean Interpurchase time 30.143 60.446 43.548
#> (SD) 7.273 78.848 35.605
#>
# 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 52.0000 Weeks
#> Holdout length 259.0000 Weeks
#>
#> Transaction Data Summary
#> Estimation Holdout Total
#> Number of customers - - 600
#> First Transaction in period 2005-01-02 2006-01-02 2005-01-02
#> Last Transaction in period 2006-01-01 2010-12-20 2010-12-20
#> Total # Transactions 1361 1822 3183
#> Mean # Transactions per cust 2.268 5.974 5.305
#> (SD) 1.695 5.908 6.119
#> Mean Spending per Transaction 40.908 37.695 39.069
#> (SD) 81.384 52.734 66.519
#> Total Spending 55676.140 68680.760 124356.900
#> Total # zero repeaters 259 - -
#> Percentage of zero repeaters 43.167 - -
#> Mean Interpurchase time 18.193 32.619 37.817
#> (SD) 12.568 27.034 42.339
#>
#> Covariates
#> Trans. Covariates Gender
#> # covs 1
#> Life. Covariates Gender
#> # covs 1
#>
# }