Skip to content

Instantly share code, notes, and snippets.

@tvladeck
Created February 20, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvladeck/a7eb353fef802697c7ac49be3cba142b to your computer and use it in GitHub Desktop.
Save tvladeck/a7eb353fef802697c7ac49be3cba142b to your computer and use it in GitHub Desktop.
# We simulate draws from two different timing distributions representing different processes
payment_failures <- rexp(1000, rate = 1/90)
intentional_churn <- rexp(1000, rate = 1/120)
### proportion of payment failures to intentional churn at 90 day cutoff
pf_90 <- (payment_failures < 90) %>% sum
if_90 <- (intentional_churn < 90) %>% sum
pf_90 / (if_90 + pf_90)
# 0.5430061
### proportion of payment failures to intentional churn at 60 day cutoff
pf_60 <- (payment_failures < 60) %>% sum
if_60 <- (intentional_churn < 60) %>% sum
pf_60 / (if_60 + pf_60)
# 0.5417633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment