# Bayes Theorem - Is this Marketing Example Correct?

I'm new to whole concept of Bayes Theorem and its applications to marketing. I've been trying to learn this on my own but unsure if I'm making dumb mistakes or if I'm applying the formula correctly - hopefully you can tell me!

I want to get the probability that a certain age group (say 18 to 25) was the group that converted given a transaction.

This is the data I used (numbers slightly changed):

group 1: age 18-24, 92 transactions, 0.65% conversion rate
group 2: 25-34, 458, 0.87%
group 3: 35-44, 480, 1.10%
group 4: 45-54, 499, 1.36%
group 5: 55-64, 582, 1.38%
group 6: 65+. 382, 1.43%


Is the following correct?

• I formulated the question as: Given a transaction, what is the probability that it came from group X?

• I took the transaction proportion and multiplied it by the conversion rate and then divided the whole thing by the sum of all the conditionals

• With this data (rounded to the nearest percent), I got 2%, 13%, 18%, 23%, 27% and 18%. So for group 1, the probability that a transaction came from 18-24 is only 2%, is this correct usage?

This feels like it's right but feeling that it's right and it actually be used correctly are two different things!

I think this is a partial answer to your question. Based on your formulation of the question, "Given a transaction, what is the prob that it came from group $X$?" can you solve that question by applying Bayes Theorem to it? Let's find out.

Applying Bayes Theorem you have the following:

$$\text{Pr}(A|B)=\frac{\text{Pr}(B|A)\text{Pr}(A)}{\text{Pr}(B|A)\text{Pr}(A)+\text{Pr}(B|A^C)\text{Pr}(A^C)}$$

where we have the following:

$A$ = the event it came from group $X$

$B$ = the given transaction

$A^C$ = the event it didn't come from group $X$

If you can fill in those probabilities then you can solve your original question.

• Thanks for this. So A would equal the probability the transaction came from Group X. So for the 18 - 24 age group, this would equal the number of transactions/total transactions for all groups. What do you mean by "B = the given transaction"? I read B given A as 'given an age group X, what is the probability of a transaction?'- this is where I used the conversion rate (transactions/visits). – David Aug 20 '14 at 17:35
• I edited my solution. I should have said A is the event that it came from group $X$. B is also an event and that event is the actual transaction that occurred. For example, lets say the transaction was buying a car so B would be the event of buying a car. So Pr(B) = "the probability of buying a car" or in your jargon the probability of a certain transaction. Hopefully that clarifies now. – Dan Aug 21 '14 at 17:19
• Ok, so this what I came up with: A would equal my click share of group X. The 18 - 24 group got 6.6% of all clicks for example. B given A would be the conversion rate (transactions/clicks to group X) - .65% for the 18 - 24 group. All divided by the sum of all probabilities. For the 18 to 24 groups I got 4%. Which would mean given a transaction, there is a 4% probability that it came from the 18 - 24 group. – David Sep 15 '14 at 21:01