# How Different Are the Averages?

The retail purchase data has purchases from all 50 states, and then some. This section addresses the question of whether the average purchase amount (in the column TotalPrice) differs by state. Statistics answers this question, and most of the calculations can be done using SQL queries.

Let’s start with the observation that the average purchase amount for the 17,839 purchases from California is $85.48 and the average purchase amount for the 53,537 purchases from New York is $70.14. Is this difference significant?

## The Approach

Let’s start by putting all the orders from New York and California into one big bucket whose overall average total price is $73.98. The question is: *What is the likelihood that a random subset of 17,839 purchases from this bucket has an average* TotalPrice *of $85.48?* If this probability is largish, then orders from California look like a random sample, and there is nothing special about them. On the other hand, a small...