A Bayesian workflow you can defend

Today let's understand how to run one Bayesian analysis so carefully that a skeptical reviewer has nowhere left to push back.

Picture an app's support team. They track how many customers escalate a problem to a human agent each day, for 60 days around the launch of a new self-serve help article: 30 days before it went live and 30 days after.

Across those 60 days, 293 customers escalated in total. The daily average was 6.0 before the article and 3.7 after it. Two of the 60 days had no escalations at all, and the busiest day saw 11.

The team wants one honest answer: did the article actually cut escalations, or could a drop this size just be noise? Getting that answer right, in a way that survives questioning, takes more than fitting one model and reading off a number. It takes an order of operations, followed every time.

Every step in this lesson follows one of these seven stages, in this order, on the support team's own 60 days of data.

The question and the two models on the table

Let's build the data first, the same way every computation in this lesson will use it.

RInteractive R
# Simulate 60 days of daily escalations, 30 days before the article and 30 days after set.seed(42) before <- rpois(30, lambda = 5.0) after <- rpois(30, lambda = 3.6) y <- c(before, after) post_ind <- c(rep(0, 30), rep(1, 30)) mean(before) #> [1] 6.033333 mean(after) #> [1] 3.733333 sum(y) #> [1] 293 sum(y == 0) #> [1] 2 max(y) #> [1] 11

  

mean(before) and mean(after) give the daily averages, 6.03 before the article and 3.73 after it. sum(y) confirms the 293 total, sum(y == 0) counts the 2 days with no escalations at all, and max(y) is the single busiest day, 11. post_ind is a 0/1 marker for whether a day comes before or after the launch, 0 for the first 30 days and 1 for the last 30. It is the switch one of the two candidate models will use, and the other will ignore.

Two models are on the table for these 60 days, each written down before either one is fitted.

Model A says the escalation rate never moved: one constant daily rate explains all 60 days, before and after the article alike.

Model B says the rate shifted the moment the article went live: one rate for the 30 days before, a different rate for the 30 days after.

Only one of those two claims can be right, or neither is. Finding out which one actually fits the data better, honestly, is the point.