Description Usage Arguments Functions See Also Examples
Functions to calculate retention for modelling with retain or renew methods.
These should only be run after preparation using yrs_zero_split
1 2 3 4 5 | yrs_calc_renew(history_split)
yrs_calc_renew_one(history_split, year0)
yrs_calc_retain(history_split, ...)
|
history_split |
license history list produced by yrs_zero_split() |
year0 |
year for defining customers for whom retention will be calculated |
... |
optional grouping variables |
yrs_calc_renew
: Calculate license buying - renewal
Appends a new "renew" variable (1=yes, 0=no) based on whether customers from year zero held licenses in subsequent years. The customers from year0 will have one record for all subsequent years.
yrs_calc_renew_one
: Calculate license buying - renewal year0
Identify renewal for selected year0. Intended to be run from
yrs_calc_renew
yrs_calc_retain
: Calculate license buying - retention rate
This essentially summarizes a customer's probability of renewing in future years.
Other functions to estimate annual license buying: yrs_avidity
,
yrs_calc_avg
, yrs_fit
,
yrs_lifetime
, yrs_plot
,
yrs_predict_avg
, yrs_predict
,
yrs_result
, yrs_zero
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(dplyr)
data(all_sports)
df_split <- yrs_zero_split(all_sports) %>%
yrs_zero_filter(function(x) filter(x, age_year %in% 30:50))
yrs_calc_renew_one(df_split, 2008)
yrs_calc_renew(df_split)
yrs_calc_retain(df_split)
library(ggplot2)
retain <- yrs_calc_retain(df_split, year0)
ggplot(retain, aes(years_since, pct, color = year0, size = n0)) +
geom_point() +
ggtitle("We see some variation in retention curves depending on year zero",
"more distant future years (years_since) have fewer observations")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.