R/f_s3generics_clvfitted.R
, R/f_s3generics_clvfittedtransactions_staticcov.R
summary.clv.fitted.Rd
Summary method for fitted CLV models that provides statistics about the estimated parameters
and information about the optimization process. If multiple optimization methods were used
(for example if specified in parameter optimx.args
), all information here refers to
the last method/row of the resulting optimx
object.
A fitted CLV model
Ignored for summary
, forwarded to printCoefmat
for print
.
an object of class "summary.clv.no.covariates"
, usually, a result of a call to summary.clv.no.covariates
.
the number of significant digits to use when printing.
logical. If TRUE, ‘significance stars’ are printed for each coefficient.
This function computes and returns a list of summary information of the fitted model
given in object
. It returns a list of class summary.clv.no.covariates
that contains the
following components:
the name of the fitted model.
The call used to fit the model.
Date or POSIXct indicating when the fitting period started.
Date or POSIXct indicating when the fitting period ended.
Length of fitting period in time.unit
s.
Time unit that defines a single period.
a px4
matrix with columns for the estimated coefficients, its standard error,
the t-statistic and corresponding (two-sided) p-value.
the value of the log-likelihood function at the found solution.
Akaike's An Information Criterion for the fitted model.
Schwarz' Bayesian Information Criterion for the fitted model.
Karush-Kuhn-Tucker optimality conditions of the first order, as returned by optimx.
Karush-Kuhn-Tucker optimality conditions of the second order, as returned by optimx.
The number of calls to the log-likelihood function during optimization.
The last method used to obtain the final solution.
A list of additional options used for model fitting.
Whether the correlation between the purchase and the attrition process was estimated.
Correlation coefficient measuring the correlation between the two processes, if used.
For models fits with static covariates, the list additionally is of class summary.clv.static.covariates
and the list in additional.options
contains the following elements:
Whether L2 regularization for parameters of contextual factors was used.
The regularization lambda used for the parameters of the Lifetime process, if used.
The regularization lambda used for the parameters of the Transaction process, if used.
Whether any covariate parameters were forced to be the same for both processes.
Name of the covariate parameters which were constraint, if used.
The model fitting functions pnbd
.
Function coef
will extract the coefficients
matrix including summary statistics and
function vcov
will extract the vcov
from the returned summary object.
# \donttest{
data("apparelTrans")
# Fit pnbd standard model, no covariates
clv.data.apparel <- clvdata(apparelTrans, time.unit="w",
estimation.split=52, date.format="ymd")
pnbd.apparel <- pnbd(clv.data.apparel)
#> Starting estimation...
#> Estimation finished!
# summary about model fit
summary(pnbd.apparel)
#> Pareto/NBD Standard Model
#>
#> Call:
#> pnbd(clv.data = clv.data.apparel)
#>
#> Fitting period:
#> Estimation start 2005-01-02
#> Estimation end 2006-01-01
#> Estimation length 52.0000 Weeks
#>
#> Coefficients:
#> Estimate Std. Error z-val Pr(>|z|)
#> r 1.3080 0.2127 6.150 7.76e-10 ***
#> alpha 46.3352 7.5456 6.141 8.22e-10 ***
#> s 0.4794 1.0791 0.444 0.657
#> beta 70.2292 202.6675 0.347 0.729
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Optimization info:
#> LL -3481.9782
#> AIC 6971.9564
#> BIC 6989.5442
#> KKT 1 TRUE
#> KKT 2 TRUE
#> fevals 25.0000
#> Method L-BFGS-B
#>
#> Used Options:
#> Correlation FALSE
# Add static covariate data
data("apparelStaticCov")
data.apparel.cov <-
SetStaticCovariates(clv.data.apparel,
data.cov.life = apparelStaticCov,
names.cov.life = "Gender",
data.cov.trans = apparelStaticCov,
names.cov.trans = "Gender",
name.id = "Id")
# fit model with covariates and regualization
pnbd.apparel.cov <- pnbd(data.apparel.cov,
reg.lambdas = c(life=2, trans=4))
#> Starting estimation...
#> Estimation finished!
# additional summary about covariate parameters
# and used regularization
summary(pnbd.apparel.cov)
#> Pareto/NBD with Static Covariates Model
#>
#> Call:
#> pnbd(clv.data = data.apparel.cov, reg.lambdas = c(life = 2, trans = 4))
#>
#> Fitting period:
#> Estimation start 2005-01-02
#> Estimation end 2006-01-01
#> Estimation length 52.0000 Weeks
#>
#> Coefficients:
#> Estimate Std. Error z-val Pr(>|z|)
#> r 1.312e+00 5.227e+00 0.251 0.802
#> alpha 4.666e+01 1.869e+02 0.250 0.803
#> s 4.818e-01 2.662e+01 0.018 0.986
#> beta 7.056e+01 4.992e+03 0.014 0.989
#> life.Gender -1.900e-03 4.992e-01 -0.004 0.997
#> trans.Gender 7.678e-03 4.992e-01 0.015 0.988
#>
#> Optimization info:
#> LL -5.8031
#> AIC 23.6061
#> BIC 49.9877
#> KKT 1 TRUE
#> KKT 2 TRUE
#> fevals 70.0000
#> Method L-BFGS-B
#>
#> Used Options:
#> Correlation FALSE
#> Regularization TRUE
#> lambda.life 2.0000
#> lambda.trans 4.0000
#> Constraint covs FALSE
# }