Mudanças entre as edições de "Bayes Theorem - Teorema de Bayes"

De Stoa
Ir para: navegação, pesquisa
m (New page: The **Bayes' theorem** is a result of probability theory that states that: math P(A|B) = \frac{P(B|A) P(A)}{P(B)} math where P(A...)
 
 
(9 edições intermediárias de 2 usuários não apresentadas)
Linha 1: Linha 1:
The **[[http://en.wikipedia.org/wiki/Bayes%27_theorem|Bayes' theorem]]** is a result of probability theory that states that:
+
The [http://en.wikipedia.org/wiki/Bayes%27_theorem Bayes' theorem] is a result of probability theory that states that:
  
[[math]]
+
<math>
 
P(A|B) = \frac{P(B|A) P(A)}{P(B)}
 
P(A|B) = \frac{P(B|A) P(A)}{P(B)}
[[math]]
+
</math>
  
 
where P(A|B) is the conditional probability of event A given event B, P(A) is the probability of event A, and so on.
 
where P(A|B) is the conditional probability of event A given event B, P(A) is the probability of event A, and so on.
Linha 13: Linha 13:
 
By the Bayes' theorem we have:
 
By the Bayes' theorem we have:
  
[[math]]
+
<math>
 
P(p | n_1,n_2) = \frac{P(n_1,n_2| p) P(p) }{P(n1,n2)}
 
P(p | n_1,n_2) = \frac{P(n_1,n_2| p) P(p) }{P(n1,n2)}
[[math]]
+
</math>
  
 
As we do not now the (unconditional) probability of the distribution being p, let's make the assumption that any distribution is as good as any other, that is, let's assume that P(p) is a constant. As P(n1,n2) does not depend on p, and we must satisfy:
 
As we do not now the (unconditional) probability of the distribution being p, let's make the assumption that any distribution is as good as any other, that is, let's assume that P(p) is a constant. As P(n1,n2) does not depend on p, and we must satisfy:
[[math]]
+
 
 +
<math>
 
\int_0^1 P(p| n_1, n_2) dp = 1
 
\int_0^1 P(p| n_1, n_2) dp = 1
[[math]]
+
</math>
  
 
Then we have:
 
Then we have:
[[math]]
+
 
 +
<math>
 
P(p | n_1,n_2) = \frac{P(n_1,n_2| p) }{ \int_0^1 P(n_1, n_2|p) dp}
 
P(p | n_1,n_2) = \frac{P(n_1,n_2| p) }{ \int_0^1 P(n_1, n_2|p) dp}
[[math]]
+
</math>
  
 
The probability that 1 happens n1 times and 2 happens n2 times given that the probability of 1 is p is given by the binomial distribution:
 
The probability that 1 happens n1 times and 2 happens n2 times given that the probability of 1 is p is given by the binomial distribution:
[[math]]
+
 
 +
<math>
 
P(n_1,n_2| p) \propto p^{n_1} (1-p)^{n_2}
 
P(n_1,n_2| p) \propto p^{n_1} (1-p)^{n_2}
[[math]]
+
</math>
  
 
Noting that:
 
Noting that:
[[math]]
+
 
 +
<math>
 
\int p^{n_1} (1-p)^{n_2} dp = \frac{n_1!n_2!}{(n_1+n_2+1)!}
 
\int p^{n_1} (1-p)^{n_2} dp = \frac{n_1!n_2!}{(n_1+n_2+1)!}
[[math]]
+
</math>
  
 
we finally get:
 
we finally get:
[[math]]
+
 
 +
<math>
 
P(p | n_1,n_2) = \frac{p^{n_1} (1-p)^{n_2}}{ \int_0^1 p^{n_1} (1-p)^{n_2} dp} = \frac{(n_1+n_2+1)!}{n_1!n_2!}p^{n_1} (1-p)^{n_2}
 
P(p | n_1,n_2) = \frac{p^{n_1} (1-p)^{n_2}}{ \int_0^1 p^{n_1} (1-p)^{n_2} dp} = \frac{(n_1+n_2+1)!}{n_1!n_2!}p^{n_1} (1-p)^{n_2}
[[math]]
+
</math>
  
 
The mean probability of 1 happening is:
 
The mean probability of 1 happening is:
[[math]]
+
 
 +
<math>
 
\left\langle p \right\rangle = \int P(p | n_1,n_2) p dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+1} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+1)!n_2!}{(n_1+n_2+2)!}
 
\left\langle p \right\rangle = \int P(p | n_1,n_2) p dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+1} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+1)!n_2!}{(n_1+n_2+2)!}
[[math]]
+
</math>
 
So:
 
So:
[[math]]
+
 
 +
<math>
 
\left\langle p \right\rangle = \frac{n_1+1}{n_1+n_2+2}
 
\left\langle p \right\rangle = \frac{n_1+1}{n_1+n_2+2}
[[math]]
+
</math>
 +
 
 +
The average quadratic probability is:
  
The mean quadratic probability is:
+
<math>
[[math]]
+
 
\left\langle p^2 \right\rangle = \int P(p | n_1,n_2) p^2 dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+2} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+2)!n_2!}{(n_1+n_2+3)!}
 
\left\langle p^2 \right\rangle = \int P(p | n_1,n_2) p^2 dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+2} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+2)!n_2!}{(n_1+n_2+3)!}
[[math]]
+
</math>
  
 
So:
 
So:
[[math]]
+
 
 +
<math>
 
\left\langle p^2 \right\rangle = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)}
 
\left\langle p^2 \right\rangle = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)}
[[math]]
+
</math>
  
 
And the variance is:
 
And the variance is:
[[math]]
+
 
 +
<math>
 
\sigma = \left\langle p^2 \right\rangle - \left\langle p \right\rangle^2 = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)} - \frac{(n_1+1)^2}{(n_1+n_2+2)^2}
 
\sigma = \left\langle p^2 \right\rangle - \left\langle p \right\rangle^2 = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)} - \frac{(n_1+1)^2}{(n_1+n_2+2)^2}
[[math]]
+
</math>
[[math]]
+
 
 +
<math>
 
\sigma = \frac{(n_1+1)(n_1+2)(n_1+n_2+2) - (n_1+1)^2(n_1+n_2+3)}{(n_1+n_2+2)^2(n_1+n_2+3)}
 
\sigma = \frac{(n_1+1)(n_1+2)(n_1+n_2+2) - (n_1+1)^2(n_1+n_2+3)}{(n_1+n_2+2)^2(n_1+n_2+3)}
[[math]]
+
</math>

Edição atual tal como às 01h48min de 4 de agosto de 2007

The Bayes' theorem is a result of probability theory that states that:


P(A|B) = \frac{P(B|A) P(A)}{P(B)}

where P(A|B) is the conditional probability of event A given event B, P(A) is the probability of event A, and so on.

Let's wonder about the following problem: given a histogram of the frequencies measured of some event, what is the probability that the real distribution is a given function?

Let's simplify by assuming an experiment with two possible outcomes (1 and 2). Let's assume that in a statistical survey, event 1 is find n1 times and event 2 n2 times. What is the probability that the real probability of event 1 is p?

By the Bayes' theorem we have:


P(p | n_1,n_2) = \frac{P(n_1,n_2| p) P(p) }{P(n1,n2)}

As we do not now the (unconditional) probability of the distribution being p, let's make the assumption that any distribution is as good as any other, that is, let's assume that P(p) is a constant. As P(n1,n2) does not depend on p, and we must satisfy:


\int_0^1 P(p| n_1, n_2) dp = 1

Then we have:


P(p | n_1,n_2) = \frac{P(n_1,n_2| p) }{ \int_0^1 P(n_1, n_2|p) dp}

The probability that 1 happens n1 times and 2 happens n2 times given that the probability of 1 is p is given by the binomial distribution:


P(n_1,n_2| p) \propto p^{n_1} (1-p)^{n_2}

Noting that:


\int p^{n_1} (1-p)^{n_2} dp = \frac{n_1!n_2!}{(n_1+n_2+1)!}

we finally get:


P(p | n_1,n_2) = \frac{p^{n_1} (1-p)^{n_2}}{ \int_0^1 p^{n_1} (1-p)^{n_2} dp} = \frac{(n_1+n_2+1)!}{n_1!n_2!}p^{n_1} (1-p)^{n_2}

The mean probability of 1 happening is:


\left\langle p \right\rangle = \int P(p | n_1,n_2) p dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+1} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+1)!n_2!}{(n_1+n_2+2)!}
So:


\left\langle p \right\rangle = \frac{n_1+1}{n_1+n_2+2}

The average quadratic probability is:


\left\langle p^2 \right\rangle = \int P(p | n_1,n_2) p^2 dp = \frac{(n_1+n_2+1)!}{n_1!n_2!} \int p^{n_1+2} (1-p)^{n_2} dp =\frac{(n_1+n_2+1)!}{n_1!n_2!}\frac{(n_1+2)!n_2!}{(n_1+n_2+3)!}

So:


\left\langle p^2 \right\rangle = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)}

And the variance is:


\sigma = \left\langle p^2 \right\rangle - \left\langle p \right\rangle^2 = \frac{(n_1+1)(n_1+2)}{(n_1+n_2+2)(n_1+n_2+3)} - \frac{(n_1+1)^2}{(n_1+n_2+2)^2}


\sigma = \frac{(n_1+1)(n_1+2)(n_1+n_2+2) - (n_1+1)^2(n_1+n_2+3)}{(n_1+n_2+2)^2(n_1+n_2+3)}

Ferramentas pessoais
Espaços nominais

Variantes
Ações
Navegação
Imprimir/exportar
Ferramentas