Na ótica bayesiana, um teste de hipóteses consiste em decidir pela rejeição ou não de uma afirmação sobre o parâmetro \(\theta\) de um experimento, baseado em observações desse experimento. Ou seja, se nossa afirmação é uma hipótese da forma \(H_0: \theta \in \Theta_0\) e \(H_1: \theta \in \Theta_1 = \Theta_0^C\), se trata essencialmente de um problema de decisão, em que o espaço de decisões é \(\mathcal{D} = \{ 0,1 \}\).
Neste caso, nossa função de decisão será dada por \[ \varphi(\mathbf{x}) = \begin{cases} 0 \text{, se decidimos } H_0 \\ 1 \text{, se decidimos } H_1 \end{cases} \] Aqui, as mesmas classificações para tipos de hipóteses e testes valem como no teste_de_hipoteses_freq.
Se \(\Theta = \{ \theta_0, \theta_1 \}\) e temos duas teste_de_hipoteses_freq \(H_0: \theta = \theta_0\) e \(H_1 = \theta = \theta_1\), supondo uma priori \(f(\theta_0) = p = 1- f(\theta_1)\), podemos tomar a perda
\(L(d, \theta)\) | \(\theta_0\) | \(\theta_1\) |
---|---|---|
\(0\) | \(0\) | \(b\) |
\(1\) | \(a\) | \(0\) |
onde \(a\) e \(b\) são arbitrários e determinam nossa proferência pelos erros de tipo I e II.
Dessa maneira, o risco de uma função de decisão \(\varphi\) é \[ \rho(\varphi, \mathbb{P}) = E[L(\varphi(\mathbf{x}), \theta)] \] condicionando em \(\Theta_0\) e \(\Theta_1\) temos \[ \begin{gather} = p \cdot E[L(\varphi(\mathbf{x}), \theta) \ | \ \theta = \theta_0] + (1-p) \cdot E[L(\varphi(\mathbf{x}), \theta) \ | \ \theta = \theta_1] \\ = p \cdot [0 \cdot \mathbb{P}(\varphi(\mathbf{x})=0 \ | \ \theta = \theta_0) + a \cdot \mathbb{P}(\varphi(\mathbf{x})=1 \ | \ \theta = \theta_0) ] + \\ + (1-p) \cdot [b \cdot \mathbb{P}(\varphi(\mathbf{x})=0 \ | \ \theta = \theta_1) + 0 \cdot \mathbb{P}(\varphi(\mathbf{x})=1 \ | \ \theta = \theta_1)] \\ = p \cdot a \cdot \underbrace{ \mathbb{P}(\varphi(\mathbf{x})=1 \ | \ \theta = \theta_0) }_{ = \mathbb{P}(\text{erro tipo I}) } + (1-p) \cdot b \cdot \underbrace{ \mathbb{P}(\varphi(\mathbf{x})=0 \ | \ \theta = \theta_1) }_{ = \mathbb{P}(\text{erro tipo II}) } \end{gather} \] Se definimos \(\mathbb{P}(\text{erro tipo I}) = \alpha\) e \(\mathbb{P}(\text{erro tipo II}) = \beta\), pelo Lema de Neyman-Pearson, o teste \(\varphi^*\) que minimiza \([pa]\alpha + [(1-p)b]\beta\) é \[ \varphi^*(\mathbf{x}) = \begin{cases} 1 \text{, se } \displaystyle \frac{f(\mathbf{x} \ | \ \theta_0)}{f(\mathbf{x} \ | \ \theta_1)} \leq \frac{b(1-p)}{a p} \\ 0 \text{, c.c.} \end{cases} \] Mas $$ \[\begin{gather} \frac{f(\mathbf{x} \ | \ \theta_0)}{f(\mathbf{x} \ | \ \theta_1)} \leq \frac{b(1-p)}{a p} \iff \frac{f(\mathbf{x} \ | \ \theta_0)}{f(\mathbf{x} \ | \ \theta_1)} \leq \frac{b f(\theta_1)}{a f(\theta_0)} \\ \iff \frac{f(\mathbf{x} \ | \ \theta_0) f(\theta_0)}{f(\mathbf{x} \ | \ \theta_1) f(\theta_1)} \leq \frac{b}{a} \iff \frac{\frac{f(\mathbf{x} \ | \ \theta_0) f(\theta_0)}{f(x)}}{\frac{f(\mathbf{x} \ | \ \theta_1) f(\theta_1)}{f(x)}} \leq \frac{b}{a} \\ \frac{f(\theta_0 \ | \ \mathbf{x})}{f(\theta_1 \ | \ \mathbf{x})} \leq \frac{b}{a} \iff \frac{f(\theta_0 \ | \ \mathbf{x})}{1 - f(\theta_0 \ | \ \mathbf{x})} \leq \frac{b}{a} \iff f(\theta_0 \ | \ \mathbf{x}) \leq \frac{b}{a+b} \end{gather}\] \[ Ou seja, a função decisão de Bayes é dada por \] ^*() = \[\begin{cases} 1 \text{, se } \displaystyle f(\theta_0 \ | \ \mathbf{x}) \leq \frac{b}{a+b} \\ 0 \text{, c.c.} \end{cases}\]$$
Para generalizar para qualquer teste bayesiano, temos \(H_0: \theta \in \Theta_0\) e \(H_1: \theta \in \Theta_1\), e a perda dada por
\(L(d, \theta)\) | \(\theta_0\) | \(\theta_1\) | |
---|---|---|---|
\(0\) | \(a_0\) | \(b_1\) | |
\(1\) | \(a_1\) | \(b_0\) |
onde supomos que \(a_0 \leq b_1\) e \(b_0 \leq a_1\), de forma que perdemos mais quando erramos pelo tipo I, e \(a_0 \leq a_1\) e \(b_0 \leq b_1\), de forma que perdemos mais quando erramos em geral.
Pela forma extensiva, o risco a posteriori de rejeitarmos \(H_0\) é \[ r_\mathbf{x}(0) = a_0 \mathbb{P}(\theta \in \Theta_0 \ | \ \mathbf{x}) + b_1 [1 - \mathbb{P}(\theta \in \Theta_0 \ | \ \mathbf{x})] \] \[ r_\mathbf{x}(1) = a_1 \mathbb{P}(\theta \in \Theta_0 \ | \ \mathbf{x}) + b_0 [1 - \mathbb{P}(\theta \in \Theta_0 \ | \ \mathbf{x})] \] Decidimos por rejeitar \(H_0\) se \[ r_\mathbf{x}(1) \leq r_\mathbf{x}(0) \iff \mathbb{P}(\theta \in \Theta_0 \ | \ \mathbf{x}) \leq \frac{b_1-b_0}{(a_1 - a_0) + (b_1 - b_0)} \]