# is my calculation of Bayes' theorem correct?

I am just starting out about learning about Bayes' theorem. The statement that I am calculating for is "I received an email, what is the probability that it is spam given that the email contains the work 'Nigeria'?". I assume that of all email messages 80% are spam and 20% are not.

W represents that percentage of emails that are not spam L denotes that the email contains the word 'Nigeria'

P(W) = 0.8 (percent of email that is spam)

P(M) = 0.2 (percent of email that is not spam)

P(L|W) = 0.95 (percent of all spam emails that have the word Nigeria in them)

P(L|M) = 0.1 (percent of all non spam emails that have the word Nigeria in them)

So solving: $$P(W|L) = {P(L|W)* P(W) \over P(L|W) * P(W) + P(L|M) * P(M)}$$

I get P(W|L) = 0.974359

Is this correct (I am asking because I want to confirm that my understanding of the this concept is correct)?

P.S. - If updated the example in this question to an example that I think is more appropriate to the theorem.

-
Your verbal glosses of W, M, L, L|W, and L|M are inconsistent. If W is the event of seeing Jupiter, and L is the event of not observing moons, then P(L|W) is the probability that you saw no moons given that you actually observed Jupiter. Is M the event of observing moons, or is it the event of not observing Jupiter? Some of your descriptions suggest one, some the other. – Brian M. Scott Sep 11 '12 at 6:24
Your interpretation of $P(A|B)$ is wrong. For example, probability of seeing planet given that the planet observed is Jupiter- that probability is 1. – Max Sep 11 '12 at 6:29
Judging from the formulas, the "not" in "W represents that percentage of emails that are not spam" seems to be there by mistake? By the way, where you write "percent(age)", you mean "fraction" or "proportion". – joriki Sep 11 '12 at 17:17
@joriki - thanks that is correct. – Josh Moore Sep 12 '12 at 1:04

Your answer is correct up to the digits you give. In mathematics, the equality sign is usually reserved for exact equalities, and approximate equalities, e.g. after rounding, are denoted by $\approx$.