Example – simulating if a customer contact will yield a sale

Here is an example that is based upon a business estimate that one of three customer contacts will result in a sale. Another assumption is that if a sale is made, it will result in an average of $100 each with a standard deviation of $5.

ExpectedPayoff either produces 0 revenue or a figure that hovers around $100, as specified in line 5 of the following code:

library(ggplot2) 
set.seed(123)
CustomerAcquired.Flag <- sample(c(0,0,1), 100, replace = TRUE)
Revenue <- sample(rnorm(100,100,5))
ExpectedPayoff <- CustomerAcquired.Flag*Revenue
head(ExpectedPayoff)
PayoffCompare = ggplot(data.frame(ExpectedPayoff), aes(x=ExpectedPayoff)) + stat_bin(binwidth=5, position="identity")
PayoffCompare

We can view this conditional customer acquisition problem as two separate charts contained within one visualization. The left side of the visualization is the count of customer contacts which result in no revenue, and the right side shows the histogram of binned sales when they occur: