# how do i use conditional probability to find the answer [closed]

• I think a tree with 2 levels of branching is the way to start: Begin with spam/no_spam, with .015/.985 probabilities respectively. Then each of those branches has explicit_url/no_explicit_url. – cumin Sep 10 '17 at 23:59
• Need a self-study tag? – Gordon Smyth Sep 11 '17 at 1:06

$P(spam|no URL) = \frac{P(no URL|spam)P(spam)}{P(no URL)}$

Therefore

$P(spam|no URL) = \frac{(0.98)(0.015)}{(0.015*0.98)+(0.985*0.03)}$

It's not counterintuitive if you understand Bayes and realise the prior probability is what really drives the posterior if it's small, but for an undergraduate answer: it's counterintuitive because it seems like it would be more "likely" that since 98% of spam comes without links and only 3% of legitimate comes without links and this doesn't have a link so it's gotta be spam, but the probability of it not being spam is higher.

This is evidently self-study, so I'll explain a general method rather than giving you the answer.

The law of total probability is a simple way to approach problems of this type. Suppose you want the probability that some event A happens, but you have to consider two possible scenarios B and C. The law of total probability says: $$P(A)=P(A|B)P(B)+P(A|C)P(C)$$ In other words, "Total Prob of A" = "Prob of A with B" + "Prob of A with C". The conditional probability of B given A is just the proportion of the total probability made up by the first term: "Prob of A with B" / "Total Prob of A".

Now try setting A to be "link is provided without URL", B to be "e-mail is spam" and C to be "e-mail isn't spam".

You will find that the e-email probably isn't spam even when a URL-less link is provided, i.e., even when it looks like spam. The reason has to do with the quality of your spam filter, but I'll let you figure out the reason in more detail.

The approach using the branches on the path is a reformulation or restatement of Tilefish Poele's answer.

There are two paths to No Explicit URL:

A: Spam --> No Explicit URL (with probability 0.015 * 0.98) B: Non_Spam --> No Explicit URL (with probability 0.985 * 0.03)

In the universe of No Explicit URL, the probability you want is A / (A + B), as in TP's answer.