June 2017
Beginner to intermediate
576 pages
15h 22m
English
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 ...