est_churn: Estimate churn by year from license history

Description Usage Arguments See Also Examples

View source: R/dashboard.R

Description

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.

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(dplyr)
data(history)
history <- history %>%
    label_categories() %>%
    recode_agecat() %>%
    filter(!agecat %in% c("0-17", "65+"))
est_churn(history)

# apply across all segments
segs <- c("tot", "res", "sex", "agecat")
sapply(segs, function(x) est_churn(history, x), simplify = FALSE)

southwick-associates/salic documentation built on Nov. 5, 2019, 9:13 a.m.