The purpose here is for a simulation.  
Randomly assign each member to a group. 
Calculate the statistic for that group.  
Compare to the same statistic for the actual group assignments

(looking at just a subset of UPCS, such as those where an add was run, or all of As & Bs)

TODO:  
To determine if there is a difference between A & B, 
Randomlly assign each A or B to a new group. 
Calculate the summary statistic for each group.
Repeat.  Look at the distribution of these summaries. 

AB <- setkey(DB.using.agg[mkt_priority %in% c("A", "B") & SpotifyAddRan], mkt_priority)
Nobs <- nrow(AB)
Aobs <- nrow(AB["A"])
# choose(195, 121) = 9e54
Nreps <- 1e5
Assignments <- {set.seed(1); replicate(Nreps, sample(Nobs, Aobs), simplify=FALSE)}
while(any(wh <- {duplicated(Assignments)})) {
  cat("Duplicates at", pasteC(which(wh), C=", ") ," ... replacing.\n")
  Assignments[wh] <- replicate(sum(wh), sample(Nobs, Aobs), simplify=FALSE)
}
MEANS <- 
sapplyt(Assignments, function(a)
  c(Mean.A = AB[a, mean(total.count.by.upc)], Mean.B = AB[!a, mean(total.count.by.upc)])
)

MEANS.DT <- data.table(MEAN=c(MEANS[[1]], MEANS[[2]]), Priority=rep(c("A", "B"), each=nrow(MEANS)))

ggplot(data=MEANS.DT, aes(x=Priority, y=MEAN, color=Priority)) + 
      geom_jitter(alpha=.2) + geom_boxplot(color="black") + 
      geom_point(x=1, y=AB["A"][, mean(total.count.by.upc)], color="red") + 
      geom_point(x=2, y=AB["B"][, mean(total.count.by.upc)], color="purple") + ylim(c(2e4, 1.25e5))


