This function requires a correctly formated history table (see history). It runs a mean of the lapse value (per year), optionally by segment (and also shifts year forward by 1 so that churn in current year reflects lapse pct from last year). It also runs a validation test: pct change per year.

est_churn(history, segment = "tot", test_threshold = 30,
  show_test_stat = FALSE, suppress_warning = FALSE, outvar = "churn")

Arguments

history

data frame: input license history table

segment

character: defaults to "tot", which indicates no segmentation. Alternatively specifiy other license history variables ("res", "sex", etc.)

test_threshold

numeric: threshold in whole number percentage points for pct change per year. A warning will be printed if the absolute value of the change for any year exceeds the threshold.

show_test_stat

logical: If TRUE, the output table will include a variable holding the test statistic for each row.

suppress_warning

logical: If TRUE, no test warning will be displayed (even if threshold is exceeded). Test statistics can still be included by setting show_test_stat = TRUE.

outvar

character: name of variable that stores metric

See also

Salic Function Reference: salic

Other dashboard functions: check_threshold, est_part, format_result, scaleup_part

Examples

library(dplyr) data(history) history <- history %>% label_categories() %>% recode_agecat() %>% filter(!agecat %in% c("0-17", "65+")) est_churn(history)
#> # A tibble: 10 x 3 #> tot year churn #> <chr> <dbl> <dbl> #> 1 All 2009 0.403 #> 2 All 2010 0.435 #> 3 All 2011 0.444 #> 4 All 2012 0.419 #> 5 All 2013 0.430 #> 6 All 2014 0.411 #> 7 All 2015 0.458 #> 8 All 2016 0.480 #> 9 All 2017 0.481 #> 10 All 2018 0.488
# apply across all segments segs <- c("tot", "res", "sex", "agecat") sapply(segs, function(x) est_churn(history, x), simplify = FALSE)
#> $tot #> # A tibble: 10 x 3 #> tot year churn #> <chr> <dbl> <dbl> #> 1 All 2009 0.403 #> 2 All 2010 0.435 #> 3 All 2011 0.444 #> 4 All 2012 0.419 #> 5 All 2013 0.430 #> 6 All 2014 0.411 #> 7 All 2015 0.458 #> 8 All 2016 0.480 #> 9 All 2017 0.481 #> 10 All 2018 0.488 #> #> $res #> # A tibble: 20 x 3 #> res year churn #> <fct> <dbl> <dbl> #> 1 Resident 2009 0.353 #> 2 Resident 2010 0.379 #> 3 Resident 2011 0.382 #> 4 Resident 2012 0.355 #> 5 Resident 2013 0.360 #> 6 Resident 2014 0.357 #> 7 Resident 2015 0.396 #> 8 Resident 2016 0.423 #> 9 Resident 2017 0.418 #> 10 Resident 2018 0.428 #> 11 Nonresident 2009 0.627 #> 12 Nonresident 2010 0.629 #> 13 Nonresident 2011 0.646 #> 14 Nonresident 2012 0.632 #> 15 Nonresident 2013 0.660 #> 16 Nonresident 2014 0.618 #> 17 Nonresident 2015 0.658 #> 18 Nonresident 2016 0.661 #> 19 Nonresident 2017 0.673 #> 20 Nonresident 2018 0.667 #> #> $sex #> # A tibble: 20 x 3 #> sex year churn #> <fct> <dbl> <dbl> #> 1 Male 2009 0.370 #> 2 Male 2010 0.407 #> 3 Male 2011 0.405 #> 4 Male 2012 0.388 #> 5 Male 2013 0.398 #> 6 Male 2014 0.374 #> 7 Male 2015 0.425 #> 8 Male 2016 0.439 #> 9 Male 2017 0.446 #> 10 Male 2018 0.454 #> 11 Female 2009 0.533 #> 12 Female 2010 0.548 #> 13 Female 2011 0.597 #> 14 Female 2012 0.543 #> 15 Female 2013 0.555 #> 16 Female 2014 0.551 #> 17 Female 2015 0.580 #> 18 Female 2016 0.637 #> 19 Female 2017 0.609 #> 20 Female 2018 0.607 #> #> $agecat #> # A tibble: 50 x 3 #> agecat year churn #> <fct> <dbl> <dbl> #> 1 18-24 2009 0.519 #> 2 18-24 2010 0.543 #> 3 18-24 2011 0.546 #> 4 18-24 2012 0.527 #> 5 18-24 2013 0.517 #> 6 18-24 2014 0.499 #> 7 18-24 2015 0.528 #> 8 18-24 2016 0.578 #> 9 18-24 2017 0.587 #> 10 18-24 2018 0.575 #> # ... with 40 more rows #>