Description Usage Arguments Functions See Also Examples
Convenience functions for the NC analysis, mainly wrappers for
yrs_result_retain
1 2 3 | nc_retain(retain_all)
nc_retain_all(history_split, ages, use_observed = FALSE)
|
retain_all |
full set of retention curve results produced by nc_retain_all() |
history_split |
license history list produced by yrs_zero_split() |
ages |
set of ages for which retention curves will be calculated separately |
use_observed |
if TRUE, return observed (instead of predicted) retention rates |
nc_retain_all
: Predict full retention curves
Other wrapper functions for NC results: nc_break_even_yrs
,
nc_break_even
,
nc_price_lifetime_youth
,
nc_retain_youth
, nc_revenue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library(dplyr)
library(ggplot2)
data(all_sports, lic, sale)
df_split <- all_sports %>%
yrs_lifetime_join(sale, lic, "sportsman") %>%
yrs_zero_split() %>%
yrs_zero_filter(function(x) filter(x, life_group == "sportsman"))
observe_all <- nc_retain_all(df_split, 52:58, use_observed = TRUE)
retain_all <- nc_retain_all(df_split, 52:58)
retain <- nc_retain(retain_all)
retain %>%
ggplot(aes(current_age, yrs)) +
geom_point() +
ggtitle("Predicted years of purchases by current age")
# observed vs predicted for specified ages
observe <- filter(observe_all, current_age == 52)
retain <- filter(retain_all, current_age == 52)
yrs_plot(retain) + geom_point(data = observe) +
ggtitle("Some noisy data points due to sample size")
observe <- filter(observe_all, current_age == 58)
retain <- filter(retain_all, current_age == 58)
yrs_plot(retain) + geom_point(data = observe) +
ggtitle("Observed rates are used for old enough buyers",
"Senior lifetime artifacts emerge at age 65")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.