0
$\begingroup$

Here is a table selected and grouped from table where i store information about client - if he churned(TRUE - he churned, FALSE he stayed) and how many refund he got. CNT counts number of rows per class.

enter image description here

I want calculate the probabilites, so let's prepare the numbers step by step. (I am inspired by this example)

I will convert the refund into discrete (refund is zero or greater than zero) variable and create a pivot table:

enter image description here

Then I calculate probabilities per class (certain cell divided by sum):

enter image description here

And then relative probabilities per class (I don't know the exact term - for example 0.36% is calculated as 6.03% * 6.02% from previous table):

enter image description here

So now I can calculate the probabilities:

X = Refund is 0; C = Client churned; not X = Refund > 0; not C = Client stayed;

What is the chance that client will leave if he has 0 refund?

Pr(C|X) = Pr(X|C)*Pr(C) / Pr(x) = 0.36%/(0.36%+88.27%)=0.41%

What is the chance that client will stay if he has 0 refund?

Pr(not C|X) = Pr(X|not C)*Pr(not C) / Pr(x) = 88.27%/(0.36%+88.27%)=99.59%

What is the chance that client will leave if he has >0 refund?

Pr(C|not X) = Pr(not X|C)*Pr(C) / Pr(not x) = 0.00%/(0.00%+0.03%)=2.36%

What is the chance that client will stay if he has >0 refund?

Pr(not C|not X) = Pr(not X|not C)*Pr(not C) / Pr(not x) =0.03%/(0.00%+0.03%)=97.64%

My question is - Can i assume anything if my data have one dominant class like this? Seems like the refund has no influence over churn. But I believe that it does have some effect.

If anyone verify the steps, it would be nice too.

Thank you.

$\endgroup$
3
$\begingroup$

The best way to think about Bayes is conditioning. So when you have a question like this:

What is the chance that client will leave if he has >0 refund?

This question is answered with just data from the refund>0 row. $50/(50+133)\approx 27,3\%$ (Matching the question, I'm using comma as the radix point.) So it is the case that churning and refunds are associated.

Suppose you insist on using Bayes. Here you have a calculation mistake--when you want to determine $P(X|C)$, you need to divide by 6,03 instead of multiplying. (We're conditioning!) 22393 out of 22443 people who churned did not receive any refunds, which is 99,77%, not 0,36%.

(How could it have been obvious that you had a mistake? Your churn chance is lower whether you had a refund or didn't have a refund than it was over the whole population!)

$P(C|not\ X) = P(not\ X|C)*P(C) / P(not\ X) = \frac{50}{22443}\frac{22443}{372246}\frac{372246}{183}=\frac{50}{183}=27,3\%$

(Note why the conditioning view makes sense; all the terms cancel out except for the ones left at the end that correspond to the exact question you asked.)

$\endgroup$
  • $\begingroup$ I edited my question, see again the definitions, hope its more clear now (you have the opposite). For P(X|C)-What is the probability have refund=0 given the fact that client churned. Of all people, 6.06% has churned. And 6.02% people have a refund, so i have to multiply no? $\endgroup$ – HonzaB Feb 23 '16 at 15:46
  • $\begingroup$ Edited to not X. $\endgroup$ – Matthew Graves Feb 23 '16 at 15:55
  • 1
    $\begingroup$ @HonzaB Most people find it easier to think in terms of frequencies than probabilities. Of all people, 183 have had a refund, and so the probability is 183/372246=0.05%. But 50 of the people who churned have had a refund, so the probability there is 50/22443 = 2.2%. $\endgroup$ – Matthew Graves Feb 23 '16 at 15:57
  • $\begingroup$ Continuing with thinking of probabilities as fractions of frequencies, dividing two probabilities is much like swapping out the denominators. That's what you want to do when you condition; P(X|C) is different from P(X) is different from P(X,C) is different from P(X)P(C). If those four aren't obviously distinct to you, you may want to spend some time reading about the vocabulary and notation of probabilities. $\endgroup$ – Matthew Graves Feb 23 '16 at 15:59
  • $\begingroup$ I see your point and my mistake now. But I have to give more thoughts. Thanks again! $\endgroup$ – HonzaB Feb 23 '16 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.