Seja \(\boldsymbol{X}_n = (X_1, \dots, X_n)\)amostra aleatória de \(X \sim f_\theta, \theta \in \Theta\).
Note que, no caso discreto: \[
P_\theta(X \in A) = \sum_{x \in A} f_\theta(x), \forall \theta \in \Theta.
\] já no caso contínuo, \[
P_\theta(X \in A) = \int_{A} f_\theta(x), \forall \theta \in \Theta.
\]
Temos uma família \(\mathcal{P} = \{P_\theta : \theta \in \Theta\}\) de probabilidades que podem explicar o comportamento dos dados. Um dos objetivos do teste de hipótese é verificar se podemos reduzir \(\mathcal{P}\) para uma família menor \(\mathcal{P}_0 \subseteq \mathcal{P}\): \[
\mathcal{P}_0 = \{P_\theta : \theta \in \Theta_0\}, \Theta_0 \subseteq \Theta.
\]
Definimos uma hipótese estatística\[
\mathcal{H}_0 : \theta \in \Theta_0 \iff \mathcal{H}_0 : P_\theta \in \mathcal{P}_0
\]\(\mathcal{H}_0\) afirma que
“A medida de probabilidade que explica os dados está em \(\mathcal{P}_0\)”
No caso em que \(\Theta_0 = \{\theta_0\}\), então a hipótese \(\mathcal{H}_0 : \theta = \theta_0 ( \iff \mathcal{H}_0 : P_{\theta} = P_{\theta_0})\) afirma que \(P_{\theta_0}\) explica o comportamento probabilístico dos dados observados.
\(\mathcal{H}_0\) é chamada de hipótese nula.
Note que a negação de \(\mathcal{H}_0\) é
“Não é o caso que a família \(\mathcal{P}_0\) contenha a medida que explica os dados”.
Ou seja, a negação de \(\mathcal{H}_0\) sugere que a medida que explica os dados pode, inclusive, não estar contida em \(\mathcal{P}\).
Observe que \(\mathcal{H}_0\) e \(\mathcal{H}_1\) não são exaustivas: na prática, ambas podem ser falsas.
Se o analista considerar que \(\mathcal{P}\) contém a medida que explica os dados, então, condicional a essa crença, \(\mathrm{\mathcal{H}_0}\) e \(\mathrm{\mathcal{H}_1}\) são exaustivas.
40.1 Exemplo
Seja \(\boldsymbol{X}_n\) a.a. de \(X\sim N(\mu, \sigma^2), \theta = (\mu, \sigma^2) \in \mathbb{R}\times\mathbb{R}_+\).
As hipóteses acima podem ser reescritas em termos das suas respectivas famílias de medidas de probabilidades da seguinte forma: \[
\begin{cases}
\mathcal{H}_0: P \in \mathcal{P}_0 \\
\mathcal{H}_1: P \in \mathcal{P}_1
\end{cases}
\]
Observe que, se assumirmos que a distribuição normal explica os dados, então \(\mathcal{H}_0\) e \(\mathcal{H}_1\) são exaustivas. Caso contrário, existe uma terceira opção: \(\neg(\mathcal{H}_0 \lor \mathcal{H}_1)\).
40.2 Hipóteses estatísticas
Toda hipótese estatística é uma interpretação de uma hipótese científica.
Hipótese científica
Hipótese estatística
Hipótese paramétrica
“A moeda é honesta”
\(X \sim \mathrm{Ber}(0.5)\)
\(\theta = 0.5\)
As hipótese estatísticas são escritas em termos de medidas de probabilidade, mas podem também ser representadas em termos do espaço paramétrico:
em que \(\mathcal{P}_0 = \{P_\theta : \theta \in \Theta_0\}\) e \(\mathcal{P}_1 = \{P_\theta : \theta \in \Theta_1\}\) e \(\Theta_1 = \Theta \setminus \Theta_0\).
Observe que \(\mathcal{H}_0, \mathcal{H}_1\) estão sempre restritas a modelo estatístico. Entretanto, a negação de \(\mathcal{H}_0, \neg \mathcal{H}_0\), não está restrita ao modelo adotado.
Algumas considerações lógicas
Se o analista considerar que \(\mathcal{H}_0\) ou \(\mathcal{H}_1\) são verdadeiros, então ele está considerando que a medida que explica ou gera os dados está em \(\mathcal{P}\). Está é a suposição de que o universo de possibilidades é fechado (suposição de Neyman-Pearson; Teoria da Decisão).
\(\mathcal{H}_0\) e \(\mathcal{H}_1\) não pode ser simultaneamente verdadeiras.
Se \(\neg \mathcal{H}_0\) e \(\neg \mathcal{H}_1\), então a medida que explica/gera os dados não está em \(\mathcal{P}\).
\(\neg \mathcal{H}_0 \not\Rightarrow \mathcal{H}_1\). Isto é, se provarmos que \(\mathcal{H}_0\) é falsa, não necessariamente \(\mathcal{H}_1\) é verdadeira.
\(\mathcal{H}_1 \Rightarrow \neg \mathcal{H}_0\).
40.3 Tipos de hipótese
Sejam \(\mathcal{H}_0, \mathcal{H}_1\) as hipóteses nula e alternativa, respectivamente, tais que \[
\begin{cases}
\mathcal{H}_0 : \theta \in \Theta_0 \\
\mathcal{H}_1 : \theta \in \Theta_1
\end{cases}
\] em que \(\Theta_0 \neq \emptyset, \Theta_0 \cup \Theta 1 = \Theta, \Theta_0 \cap \Theta_1 = \emptyset\). Dizemos que \(\mathcal{H}_0\) é uma hipótese simples se \(\# \Theta_0 = 1\). Caso contrário, dizemos que é uma hipótese composta.
40.3.1 Exemplos
Seja \(\boldsymbol{X}_n = (X_1, \dots, X_n)\) a.a. de \(X\sim \mathrm{Ber}(\theta), \theta \in \{0.5, 0.9\}\). Considere as hipóteses \[
\begin{cases}
\mathcal{H}_0 : \theta = 0.5 \\
\mathcal{H}_1 : \theta = 0.9
\end{cases}\ \ \ \text{Ambas são simples!}
\]
Definição. A função poder do teste \(\delta\) é \(\pi_\delta(\theta) = P_\theta(S_\delta)\)
Observações
\[
\pi_\delta(\theta), \forall \theta \in \Theta_0,
\] são probabilidades de rejeitar \(\mathcal{H}_0\) quando esta é verdadeira.
\[
\pi_\delta(\theta), \forall \theta \in \Theta_1,
\] são probabilidades de rejeitar \(\mathcal{H}_0\) quando esta é falsa.
Definição. O nível de significância é qualquer valor \(\alpha \in (0,1)\) tal que: \[
P_\theta(S_\delta) \leq \alpha, \forall \theta \in \Theta_0.
\] em termos de função poder, \[
\pi_\delta(\theta) \leq \alpha, \forall \theta \in \Theta_0
\]
Definição. O tamanho do teste \(\delta\) é \[
\tau_\delta = \sup_{\theta \in \Theta_0} P_\theta(S_\delta) \leq \alpha
\] em termos de função poder, \[
\tau_\delta = \sup_{\theta \in \Theta_0} \pi_\delta(\theta)
\]
40.4.2.1 Probabilidade dos Erros I, II
Tipos de Erro
Relembrando os tipos de erro: \[
\begin{cases}
\text{Erro tipo I:}\ \text{Rejeitar $\mathcal{H}_0$ quando esta é verdadeira} \\
\text{Erro tipo II:}\ \text{Não rejeitar $\mathcal{H}_0$ quando esta é falsa}
\end{cases}
\]
\[
\alpha_{\delta, \mathrm{max}} = \tau_\delta = \sup_{\theta \in \Theta_0} \pi_\delta(\theta)
\] é a probabilidade máxima de cometer o Erro tipo I e \[
\beta_{\delta, \mathrm{max}} = \sup_{\theta \in \Theta_1} (1-\pi_\delta(\theta))
\] é a probabilidade máxima de cometer o Erro tipo II.
Alguns livros, especialmente para iniciantes ou profissionais de outras áreas, podem escrever: \[
\begin{aligned}
\alpha_{\delta, \max} &= P(\text{Erro tipo I}) \\
&= P(\text{Rejeitar} | \text{$\mathcal{H}_0$ é verdadeira}) \\
&= P(\delta(\boldsymbol{X}_n) = 1 | \text{$\mathcal{H}_0$ é verdadeira}),
\end{aligned}
\]\[
\begin{aligned}
\beta_{\delta, \max} &= P(\text{Erro tipo II}) \\
&= P(\text{Não rejeitar} | \text{$\mathcal{H}_0$ é falsa}) \\
&= P(\delta(\boldsymbol{X}_n) = 0 | \text{$\mathcal{H}_0$ é falsa}).
\end{aligned}
\] Note que, formalmente, isso não faz sentido na estatística clássica! O parâmetro em hipótese, \(\theta\), é desconhecido mas não aleatório.
Note que, na estatística clássica, as hipóteses são afirmações epistêmicas, e não experimentais (eventos do experimento). Portanto, não são elementos da \(\sigma\)-álgebra do modelo estatístico. Logo, a notação \[
P(S_\delta | \text{$\mathcal{H}_0$ é verdadeira})
\] não está bem definida.
40.4.2.2 Poder do Teste
Se \(\mathcal{H}_1\) for simples, isto é, \(\mathcal{H}_1 : \theta = \theta_1\), então o poder do teste é definido \[
1 - \beta_{\delta, \max} = \pi_\delta(\theta_1)
\]
Notação (equivocada) em alguns materiais
Alguns livros escrevem \[
\mathrm{poder} = P(\text{Rejeitar $\mathcal{H}_0$} | \text{$\mathcal{H}_0$ é falsa})
\] Isto está incorreto na interpretação clássica de estatística!
40.5 Lema de Neyman-Pearson
Estamos interessados em um teste \(\delta^*\) que produza menor \(\alpha_{\delta^*, \max}\) e maior poder possível. O Lema de Neyman-Pearson apresenta um teste que, dentre os testes de tamanho \(\alpha\), tem maior poder.
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim f_\theta, \theta \in \Theta = \{\theta_0, \theta_1\}\). Considere as hipóteses \[
\begin{cases}
\mathcal{H}_0 : \theta = \theta_0 \\
\mathcal{H}_1 : \theta = \theta_1
\end{cases}
\] nula e alternativa. A função teste \(\delta^* : \mathfrak{X}^{(n)} \rightarrow \{0,1\}\) tal que \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}(\theta_1) < \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}(\theta_0) \\
1,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}(\theta_1) \geq \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}(\theta_0),
\end{cases}
\] em que \(\eta\) satisfaz \(\underbracket{P_{\theta_0}(\delta^*(\boldsymbol{X}_n) = 1)}_{\pi_{\delta^*}(\theta_0)} = \alpha\) para um \(\alpha\) fixado apriori, é o teste mais poderoso dentre todo os testes de tamanho \(\alpha\).
40.5.1 Exemplo (Normal)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim N(\mu, \sigma^2)\) em que \(\theta = (\mu, \sigma^2) \in \{(0,1), (0,2)\}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta = (0,1) \\
\mathcal{H}_1 : \theta = (0,2)
\end{cases}
\] as hipóteses nula e alternativa.
Encontre o teste mais poderoso de tamanho \(\alpha = 5\%\).
40.5.1.1 Solução:
De acordo com o Lema de Neyman-Pearson, o teste mais poderoso de tamanho \(\alpha = 5\%\) é \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}((0,2)) < \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}((0,1)), \\
1,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}((0,2)) \geq \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}((0,1)),
\end{cases}
\] em que \(\eta\) satisfaz \(\pi_{\delta^*}((0,1)) = 5\%\).
Observe ainda que \[
\begin{aligned}
\pi_{\delta^*}((0,1)) &= P_{(0,1)}(\delta^*(\boldsymbol{X}_n) = 1) \\
&\stackrel{\text{Def.}}{=} P_{(0,1)}\left(\frac{\mathcal{L}_{\boldsymbol{x}_n}((0,2))}{\mathcal{L}_{\boldsymbol{x}_n}((0,1))} \geq \eta\right) \\
&\stackrel{\text{Desenv.}}{=} P_{(0,1)}\left(\sum X_i^2 \geq \eta^*\right),
\end{aligned}
\] em que \(\eta^* = 4\ln(2^{n/2} \eta)\). Como, sob \(\mathcal{H}_0, \sum X_i^2 \sim \chi^2_n\), temos que \[
\pi_{\delta^*}((0,1)) = P_{(0,1)}(\chi^2_{n} \geq \eta^*) = 5\%.
\]
Com \(n=2\), temos que \[
\pi_{\delta^*}((0,1)) = P_{(0,1)}(\chi^2_{n} \geq \eta^*) = 5\%. \Rightarrow \eta^* = 5.991.
\]
Portanto, o teste mais poderoso é \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0,\ \text{se}\ \sum x_i^2 < 5.991 \\
1,\ \text{se}\ \sum x_i^2 \geq 5.991.
\end{cases}
\]
40.5.2 Exemplo (Bernoulli)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim \mathrm{Ber}(\theta), \theta \in \{0.1, 0.9\}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta = 0.9 \\
\mathcal{H}_1 : \theta = 0.1
\end{cases}
\] as hipóteses nula e alternativa e \(n=10\). Encontre o Teste Mais Poderoso (TMP) de tamanho \(\alpha = 10\%\).
40.5.2.1 Resposta
De acordo com o Lema de Neyman-Pearson, o teste mais poderoso de tamanho \(\alpha = 5\%\) é \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}(0.1) < \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}(0.9), \\
1,\ \text{se}\ \mathcal{L}_{\boldsymbol{x}_n}(0.1) \geq \eta \cdot \mathcal{L}_{\boldsymbol{x}_n}(0.9),
\end{cases}
\] em que \(\eta\) satisfaz \(\pi_{\delta^*}(0.9) = 10\%\).
Note que, sob \(\mathcal{H}_0, \sum^10_{i=1} X_i \sim \mathrm{Bin}(10, 0.9)\). Ademais, \[
P_{0.9}(\sum X \leq 7) = 0.0702,\ \ \
P_{0.9}(\sum X \leq 8) = 0.2639.
\] Logo, não é possível encontrar um valor para \(\eta\) exato com esse tamanho do teste.
40.6 Testes uniformemente mais poderosos (TUMP)
Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \in \Theta_0 \\
\mathcal{H}_1 : \theta \in \Theta_1
\end{cases}
\] as hipóteses nula e alternativa em que \(\Theta_0 \cup \Theta_1 = \Theta, \Theta_0 \cap \Theta_1 = \emptyset, \#(\Theta_0) \geq 1, \#(\Theta_1) \geq 1\). O teste de tamanho \(\alpha\)\(\delta^* : \mathfrak{X}^{(n)} \rightarrow \{0,1\}\) é uniformemente mais poderoso se, e somente se,
Para qualquer outro teste \(\delta\) tal que \(\pi_{\delta}(\theta) \leq \alpha, \underbrace{\forall \theta \in \Theta_0}_{\text{Sob}\ \mathcal{H}_0}\), então \[
\pi_{\delta^*}(\theta) \geq \pi_{\delta}(\theta), \underbrace{\forall \theta \in \Theta_1}_{\text{Sob}\ \mathcal{H}_1}.
\]
40.6.1 Teorema de Karlin-Rubin (I)
Uma generalização do Lema de Neyman-Pearson.
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim f_\theta, \theta \in \Theta \subseteq \mathbb{R}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \leq \theta_0\\
\mathcal{H}_1 : \theta > \theta_0
\end{cases}
\] em que \(\theta_0\) é um valor dado. Se a razão de verossimilhanças\[
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{x}_n)) = \frac{\mathcal{L}_{\boldsymbol{x}_n}(\theta')}{\mathcal{L}_{\boldsymbol{x}_n}(\theta'')}
\] for monótona não-decrescente e \(\theta' \geq \theta''\), em que \(T(\boldsymbol{x}_n)\) é uma estatística suficiente para o modelo, então o teste \(\delta^* : \mathfrak{X}^{(n)} \rightarrow \{0, 1\}\) tal que \[
\delta^* (\boldsymbol{x}_n) = \begin{cases}
0, T(\boldsymbol{x}_n) < c \\
1, T(\boldsymbol{x}_n) \geq c,
\end{cases}
\] e \(c\) satisfaz \[
\pi_{\delta^*}(\theta_0) = P_{\theta_0}(\delta^*(\boldsymbol{x}_n) = 1) = \alpha,
\] é o teste uniformemente mais poderoso de tamanho \(\alpha\).
40.6.1.1 Exemplo (Normal)
Seja \(\boldsymbol{X}_n\) a.a. de \(X\sim N(\theta, 2), \theta \in \Theta \subseteq \mathbb{R}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \leq 1\\
\mathcal{H}_1 : \theta > 1.
\end{cases}
\] Encontre o TUMP de tamanho \(\alpha = 10\%\).
40.6.1.1.1 Resposta
A função de verossimilhança é dada por \[
\begin{aligned}
\mathcal{L}_{\boldsymbol{x}_n}(\theta) &= \left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum (x_i - \theta)^{2} \right\} \\ &=
\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta\sum x_i + n\theta^2 \right\}.
\end{aligned}
\] Pelo Critério de Fatoração de Fisher, \(T(\boldsymbol{X}_n) = \sum x_i\) é uma estatística suficiente. Note que \[
\begin{aligned}
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{X}_n)) &= \frac{\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta'\sum x_i + n\theta'^2 \right\}}{\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta''\sum x_i + n\theta''^2 \right\}} \\
&= \mathrm{Exp}\left\{-\frac{1}{4}(-\theta'T(\boldsymbol{x}_n) + n\theta'^2 + 2\theta''T(\boldsymbol{x}_n) - n\theta''^2\right\} \\
&= \mathrm{Exp}\left\{\frac{1}{2}(\theta' - \theta'')T(\boldsymbol{x}_n)-\frac{1}{4} n\theta''^2 +\frac{1}{4}\theta''^2\right\}.
\end{aligned}
\] Como \(\theta' \geq \theta''\), temos que \(\theta' - \theta'' \geq 0\). Logo, \(\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{x}_n))\) é uma função monótona não-decrescente em \(T(\boldsymbol{x}_n)\). Logo, pelo Teorema de Karlin-Rubin (I), temos que \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0, \sum x_i < c \\
1, \sum x_i \geq c
\end{cases}
\] em que \(c\) satisfaz \[
\pi_{\delta^*}(1) = P_{1}(\sum X_i \geq c) = \alpha.
\]
Com \(n = 5\), temos que, quando \(\theta = 1\), \(\sum X_i \sim N(1 \cdot 5, 5 \cdot 2)\). Assim, \[
\begin{aligned}
P_{1}(\sum X_i \geq c) &= P_1\left(\frac{\sum x_i - 5}{\sqrt{10}} \geq \frac{c - 5}{\sqrt{10}}\right) = 0.1 \\
\Rightarrow \frac{c - 5}{\sqrt{10}} &= 1.28 \\
\Rightarrow c &= 1.28 \cdot \sqrt{10} + 5 = 9.064 \\
\Rightarrow \delta^*(\boldsymbol{x}_n) &= \begin{cases}
0, \sum x_i < 9.064 \\
1, \sum x_i \geq 9.064
\end{cases}
\end{aligned}
\] Portanto, se \(\sum x_i < 9.064\), dizemos que não há evidencias para rejeitarmos \(\mathcal{H}_0\) a \(10\%\) de significância estatística. Se \(\sum x_i \geq 9.064\), dizemos que há evidencias para rejeitarmos \(\mathcal{H}_0\) a \(10\%\) de significância estatística.
40.6.1.2 Exemplo (Exponencial)
Seja \(\boldsymbol{X}_n\) a.a. de \(X\sim \mathrm{Exp}(\theta), \theta \in \Theta \subseteq \mathbb{R}_+\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \leq 2\\
\mathcal{H}_1 : \theta > 2.
\end{cases}
\] Encontre o TUMP de tamanho \(\alpha = 5\%\).
40.6.1.2.1 Resposta
A função de verossimilhança é dada por \[
\begin{aligned}
\mathcal{L}_{\boldsymbol{x}_n}(\theta) &= \theta^n \cdot \mathrm{e}^{-\theta \sum x_i}.
\end{aligned}
\]
Pelo Critério de Fatoração de Fisher, \(T(\boldsymbol{X}_n) = \sum X_i\) é uma estatística suficiente. \[
\begin{aligned}
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{X}_n)) &= \frac{\theta'^n \cdot \mathrm{e}^{-\theta' \sum x_i}}{\theta''^n \cdot \mathrm{e}^{-\theta'' \sum x_i}} \\
&= \left(\frac{\theta'}{\theta''}\right)^n \mathrm{Exp} \left\{ -\theta' T(\boldsymbol{x}_n) + \theta''T(\boldsymbol{x}_n) \right\} \\
&= \left(\frac{\theta'}{\theta''}\right)^n \mathrm{Exp} \left\{ (\theta'' - \theta') T(\boldsymbol{x}_n)\right\}, \theta' \geq \theta''.
\end{aligned}
\] Como \(\theta' \geq \theta''\), temos que \(\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{X}_n))\) é decrescente em \(T(\boldsymbol{x}_n)\). Tome \(T'(\boldsymbol{x}_n) = - \sum x_i\), logo \[
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{X}_n)) = \left(\frac{\theta'}{\theta''}\right)^n \mathrm{Exp}
\left\{(\theta' - \theta'') T(\boldsymbol{x}_n)\right\}, \theta' \geq \theta''.
\] é monótona não-decrescente em \(T'(\boldsymbol{x}_n)\). Portanto, pelo Teorema de Karlin-Rubin (I), \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0, \sum -x_i < c \\
1, \sum -x_i \geq c
\end{cases} \Rightarrow
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0, \sum x_i > -c \\
1, \sum x_i \leq -c
\end{cases}
\] em que \(c\) satisfaz \[
\pi_{\delta^*}(1) = P_{1}(\sum X_i \leq -c) = \alpha.
\] Para \(n=10\), sob \(\theta = 2, \sum X_i \sim \mathrm{Gama}(10,2)\). Computacionalmente, o quantil \(0.05\) dessa distribuição é \(2.7127\). Logo, \(-c = 2.7127 \Rightarrow c = -2.7127\). Dessa forma, se \(\sum x_i > 2.7127\), dizemos que não há evidencias para rejeitarmos \(\mathcal{H}_0\) a \(5\%\) de significância estatística. Se \(\sum x_i \leq 2.7127\), dizemos que há evidencias para rejeitarmos \(\mathcal{H}_0\) a \(5\%\) de significância estatística.
40.6.2 Teorema de Karlin-Rubin (II)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim f_\theta, \theta \in \Theta \subseteq \mathbb{R}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \geq \theta_0\\
\mathcal{H}_1 : \theta < \theta_0
\end{cases}
\] em que \(\theta_0\) é um valor dado. Se a razão de verossimilhanças\[
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{x}_n)) = \frac{\mathcal{L}_{\boldsymbol{x}_n}(\theta')}{\mathcal{L}_{\boldsymbol{x}_n}(\theta'')}
\] for monótona não-crescente e \(\theta' \leq \theta''\), em que \(T(\boldsymbol{x}_n)\) é uma estatística suficiente para o modelo, então o teste \(\delta^* : \mathfrak{X}^{(n)} \rightarrow \{0, 1\}\) tal que \[
\delta^* (\boldsymbol{x}_n) = \begin{cases}
0, T(\boldsymbol{x}_n) > c \\
1, T(\boldsymbol{x}_n) \leq c,
\end{cases}
\] e \(c\) satisfaz \[
\pi_{\delta^*}(\theta_0) = P_{\theta_0}(\delta^*(\boldsymbol{x}_n) = 1) = \alpha,
\] é o teste uniformemente mais poderoso de tamanho \(\alpha\).
40.6.2.1 Exemplo (Normal)
Seja \(\boldsymbol{X}_n\) a.a. de \(X\sim N(\theta, 2), \theta \in \Theta \subseteq \mathbb{R}\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \geq 1\\
\mathcal{H}_1 : \theta < 1.
\end{cases}
\] Encontre o TUMP de tamanho \(\alpha\).
40.6.2.1.1 Resposta
A função de verossimilhança é dada por \[
\begin{aligned}
\mathcal{L}_{\boldsymbol{x}_n}(\theta) &= \left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum (x_i - \theta)^{2} \right\} \\ &=
\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta\sum x_i + n\theta^2 \right\}.
\end{aligned}
\] Pelo Critério de Fatoração de Fisher, \(T(\boldsymbol{X}_n) = \sum x_i\) é uma estatística suficiente. Note que \[
\begin{aligned}
\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{X}_n)) &= \frac{\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta'\sum x_i + n\theta'^2 \right\}}{\left(\frac{1}{\sqrt{4\pi}}\right)^n \mathrm{Exp}\left\{
-\frac{1}{4} \sum x_i^2 - 2\theta''\sum x_i + n\theta''^2 \right\}} \\
&= \mathrm{Exp}\left\{-\frac{1}{4}(-\theta'T(\boldsymbol{x}_n) + n\theta'^2 + 2\theta''T(\boldsymbol{x}_n) - n\theta''^2\right\} \\
&= \mathrm{Exp}\left\{\frac{1}{2}(\theta' - \theta'')T(\boldsymbol{x}_n)-\frac{1}{4} n'\theta^2 +\frac{1}{4}\theta''^2\right\}.
\end{aligned}
\] Como \(\theta' \leq \theta''\), temos que \(\theta' - \theta'' \leq 0\). Logo, \(\mathrm{R}_{\theta',\theta''}(T(\boldsymbol{x}_n))\) é uma função monótona não-crescente em \(T(\boldsymbol{x}_n)\). Logo, pelo Teorema de Karlin-Rubin (II), temos que \[
\delta^*(\boldsymbol{x}_n) = \begin{cases}
0, \sum x_i > c \\
1, \sum x_i \leq c
\end{cases}
\] em que \(c\) satisfaz \[
\pi_{\delta^*}(1) = P_{1}(\sum X_i \leq c) = \alpha.
\]
40.6.3 Simulações
# Seja X a.a. de X ~ Exp()# H_0 θ ≤ 2; H_1 θ > 2# δ(x) = 1 ⟺ ∑ x ≤ 2.71usingDistributions, Random, StatsBaseRandom.seed!(24)# Borda do Θ_0θ_0 =2# Valores do teste e amostran =100α =0.05MC =10_000functionh0()# Sob H_0 θ_00 =rand(Uniform(0, θ_0)) d =Exponential(1/ θ_00) dsoma =Gamma(n, 1/ θ_00) c =quantile(dsoma, α) δ =zeros(MC)for i in1:MC x =rand(d, n) δ[i] =sum(x) ≤ cendreturnprintln("Testes rejeitados sob H_0: $(mean(δ) *100)%")endfunctionh1()# Sob H_0 θ_11 =rand(Uniform(θ_0, θ_0 +10)) d =Exponential(1/ θ_11) dsoma =Gamma(n, 1/ θ_11) c =quantile(dsoma, α) δ =zeros(MC)for i in1:MC x =rand(d, n) δ[i] =sum(x) ≥ cendreturnprintln("Testes rejeitados sob H_1 (Poder do teste): $(mean(δ) *100)")endh0()h1()
Testes rejeitados sob H_0: 4.9799999999999995%
Testes rejeitados sob H_1 (Poder do teste): 95.6
40.7 Testes de hipótese gerais
Considere \[
\begin{cases}
\mathcal{H}_0 : \theta \in \Theta_0 \\
\mathcal{H}_1 : \theta \in \Theta_1
\end{cases}
\] as hipóteses nula e alternativa em que \(\Theta_0 \cup \Theta_1 = \Theta, \Theta_0 \cap \Theta_1 = \emptyset, \#(\Theta_0) \geq 1, \#(\Theta_1) \geq 1\).
O teste da razão de verossimilhanças generalizada de tamanho \(\alpha\) é \(\delta:\mathfrak{X}^{(n)}\rightarrow \{0,1\}\) tal que
\[
\delta(\boldsymbol{X}_n) = \begin{cases}
0,\ \boldsymbol{x}_n \not\in A_c
1,\ \boldsymbol{x}_n \in A_c
\end{cases}
\] e \(\sup\limits_{\theta \in \Theta_0}\pi_\delta(\theta) = \alpha\), em que
A constante \(c\) é obtida resolvendo \(\sup\limits_{\theta \in \Theta_0}\pi_\delta(\theta) = \alpha\)
Teste de Neyman-Pearson
Se \(\Theta_0 = \{\theta_0\}, \Theta_1 = \{\theta_1\}\), temos o teste mais poderoso de Neyman-Pearson.
TUMP de Karlin-Rubin I e II
Se \(\Theta_0 = (-\infty \theta_0] \cap \Theta, \Theta_1 = (\theta_1, \infty) \cap \Theta\), temos o teste uniformemente mais poderoso de Karlin-Rubin (I). Por sua vez, se \(\Theta_0 = [\theta_0, \infty) \cap \Theta, \Theta_1 = (-\infty \theta_1) \cap \Theta\), temos o teste uniformemente mais poderoso de Karlin-Rubin (II)
40.7.1Estatística da razão de verossimilhanças generalizada
é a estatística da razão de verossimilhanças generalizada.
Denote por \(\hat{\theta}_0\) o estimador para “\(\theta\)” sob \(\mathcal{H}_0\), ou seja, \[
\hat{\theta}_0 = \mathrm{argmax}_{\theta \in \Theta_0} \mathcal{L}_{\boldsymbol{x}_n}(\theta)
\] sempre que existir. Denote também \[
\hat{\theta}_{\mathrm{MV}} = \mathrm{argmax}_{\theta \in \Theta} \mathcal{L}_{\boldsymbol{x}_n}(\theta)
\] o estimador de máxima verossimilhança não restrito a \(\mathcal{H}_0\). A estatística da razão de verossimilhança generalizada pode ser reescrita:
Note que a Equação 40.1 é bem definida sempre que \(0 < \sup\limits_{\theta \in \Theta} \mathcal{L}_{\boldsymbol{x}_n}(\theta) < \infty\). Em alguns casos, a Equação 40.2 não pode ser resolvida por não existir um argumento que maximize a função de verossimilhança sob a hipótese nula.
Observe que \(\mathcal{H}_0 : \theta = \theta_0\) contra \(\mathcal{H}_1 : \theta = \theta_1\) e \(\Theta \subseteq \mathbb{R}\), \[
\lambda(\boldsymbol{x}_n; \Theta_0) =
\frac{\mathcal{L}_{\boldsymbol{x}_n}(\theta_0)}
{\mathcal{L}_{\boldsymbol{x}_n}(\hat{\theta}_{\mathrm{MV}})}
\]
Teorema. Sob as condições de regularidade e com \(\dim(\Theta_0) < \dim(\Theta)\), temos que \[
-2\ln \lambda(\boldsymbol{X}_n, \Theta_0) \stackrel{\mathcal{D}}{\rightarrow} \chi^2_{s},
\] em que \(s = \dim(\Theta) - \dim(\Theta_0)\). Supõe-se que o conjunto \(\Theta_0\)não contém singularidades.
O teste da Razão de Verossimilhança Generalizada (RVG) pode ser reescrito: \[
\begin{aligned}
\delta(\boldsymbol{x}_n) &= \begin{cases}
0,\ \ \frac{\mathcal{L}_{\boldsymbol{x}_n}(\hat{\theta}_0)}
{\mathcal{L}_{\boldsymbol{x}_n}(\hat{\theta}_{\mathrm{MV}})} > \frac{1}{c} \\
1,\ \ \frac{\mathcal{L}_{\boldsymbol{x}_n}(\hat{\theta}_0)}
{\mathcal{L}_{\boldsymbol{x}_n}(\hat{\theta}_{\mathrm{MV}})} \leq \frac{1}{c}
\end{cases} \\
\iff
\delta(\boldsymbol{x}_n) &= \begin{cases}
0,\ \ \lambda(\boldsymbol{x}_n, \Theta_0) > \frac{1}{c} \\
1,\ \ \lambda(\boldsymbol{x}_n, \Theta_0) \leq \frac{1}{c}
\end{cases} \\
\iff
\delta(\boldsymbol{x}_n) &= \begin{cases}
0,\ \ -2 \ln \lambda(\boldsymbol{x}_n, \Theta_0) < 2\ln c \\
1,\ \ -2 \ln \lambda(\boldsymbol{x}_n, \Theta_0) \geq 2 \ln c
\end{cases} \\
\end{aligned}
\] em que \(c\) deve satisfazer
Se a distribuição exata de \(-2\ln \lambda(\boldsymbol{X}_n, \Theta_0)\) for conhecida, entã basta encontrar \(2\ln c\) que satisfaça a Equação 40.3.
Caso contrário, utilizamos o teorema anterior: \[
-2\ln \lambda(\boldsymbol{X}_n, \Theta_0) \stackrel{\mathcal{D}}{\rightarrow} \chi^2_{s},
\] em que \(s = \dim(\Theta) - \dim(\Theta_0)\)
40.7.2 Exemplo (Normal)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim N(\theta,1), \theta \in \Theta \subseteq \mathbb{R}\), e considere \[
\begin{cases}
\mathcal{H}_0 : \theta = 0 \\
\mathcal{H}_1 : \mu \neq 0,
\end{cases}
\] as hipóteses nula e alternativa. Encontre o teste da razão de verossimilhanças generalizada de tamanho \(\alpha\).
Assim, \[
\begin{aligned}
\lambda(\boldsymbol{x}_n; \Theta_0) &=
\frac{\sup\limits_{\theta \in \Theta_0} \mathcal{L}_{\boldsymbol{x}_n}(\theta)}
{\sup\limits_{\theta \in \Theta} \mathcal{L}_{\boldsymbol{x}_n}(\theta)}\\
&= \frac{\mathcal{L}_{\boldsymbol{x}_n}(0)} {\mathcal{L}_{\boldsymbol{x}_n}(\bar{x})} \\
&= \mathrm{Exp}\left\{
-\frac{1}{2} \sum x_i^2 + \frac{1}{2}\left(\sum x_i^2 - 2n \bar{x}^2 + n \bar{x}^2\right)
\right\} = \mathrm{e}^{-\frac{1}{2}n\bar{x}^2}
\end{aligned}
\] Portanto, \[
-2\ln \lambda(\boldsymbol{x}_n, \Theta_0) = n \bar{x}^2.
\] Sob \(\mathcal{H}_0\), \(\theta =0, \bar{X} \sim N(0, 1/n), \sqrt{n}\bar{X} \sim N(0,1) \Rightarrow n \bar{X}^2 \sim \chi^2_1\). Logo, o teste de RVG é \[
\delta(\boldsymbol{x}_n) = \begin{cases}
0,\ \ n\bar{x}^2 < 2\ln c
1,\ \ n\bar{x}^2 \geq 2\ln c
\end{cases}
\] em que \(c\) deve satisfazer \[
\sup\limits_{\theta \in \Theta_0} P_\theta(n\bar{X}^2 \geq 2 \ln c) = \alpha.
\] Note que \(\forall \theta \in \Theta_0\), \(n\bar{X}^2 \sim \chi^2_1\) (é ancilar ao modelo reduzido). Portanto, \[
\sup\limits_{\theta \in \Theta_0} P_{0}(n\bar{X}^2 \geq c^*) = P(\chi^2_1 \geq c^*) = \alpha.
\] Tomando \(c^* = 2\ln c\), podemos obter o valor para \(c^*\) de uma qui-quadradado com \(1\) grau de liberdade para qualquer valor de \(\alpha\). Por exemplo, se \(\alpha = 10\%, c^* = 2.70\). Se \(\alpha = 5\%, c^* = 3.84\), etc.
40.7.3 Exemplo (Poisson)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim \mathrm{Poiss}(\theta), \theta \in \Theta = (0, \infty)\). Considere \[
\begin{cases}
\mathcal{H}_0 : \theta = \theta_0 \\
\mathcal{H}_1 : \mu \neq \theta_0,
\end{cases}
\] as hipóteses nula e alternativa. Encontre o teste da razão de verossimilhanças generalizada de tamanho \(\alpha\). Use o resultado assintótico.
40.7.3.1 Resposta
Já sabemos que \(\hat{\theta}_{\mathrm{MV}} = \bar{X}\) e \[
\begin{aligned}
\mathcal{L}_{\boldsymbol{x}_n}(\theta) &= \mathrm{e}^{n\theta} \cdot \frac{\theta^{\sum x_i}}{\prod (x_i!)} \\
\Rightarrow \lambda(\boldsymbol{x}_n, \Theta_0) &= \frac{\mathrm{e}^{n\theta_0} \cdot \frac{\theta_0^{\sum x_i}}{\prod (x_i!)}}
{\mathrm{e}^{n\bar{x}} \cdot \frac{\bar{x}^{\sum x_i}}{\prod (x_i!)}} \\
&= \mathrm{e}^{n\theta_0+n\bar{x}} \cdot \left(\frac{\theta_0}{\bar{x}}\right)^{\sum x_i}
\end{aligned}
\] Sabemos que, sob \(\mathcal{H}_0, \ (\mathrm{i.e.}\ \forall \theta \in \Theta_0)\), \(-2\ln \lambda(\boldsymbol{X}_n, \Theta_0) \stackrel{\mathcal{D}}{\rightarrow} \chi^2_1\). Assim, \[
\begin{aligned}
2n\theta_0 - 2n\bar{X} - 2n\bar{X}\ln\left(\frac{\theta_0}{\bar{X}}\right) = \underbrace{2n\theta_0 -2n\bar{X} -2n\bar{X} \ln \theta_0 + 2n\bar{X} \ln \bar{X}}_{T(\boldsymbol{X}_n)}
\stackrel{\mathcal{D}}{\rightarrow} \chi^2_1.
\end{aligned}
\] Logo, o teste de RVG é \[
\delta(\boldsymbol{x}_n) = \begin{cases}
0,\ \ T(\boldsymbol{x}_n) < c^*
1,\ \ T(\boldsymbol{x}_n) \geq c^*
\end{cases}
\] em que \(c\) deve satisfazer \[
\sup\limits_{\theta \in \Theta_0} P_\theta(n\bar{X}^2 \geq c^*) = P_{\theta_0}(T(\boldsymbol{X}_n) \geq c^*) = \alpha.
\] Pela aproximação, \[
P_{\theta_0}(T(\boldsymbol{X}_n) \geq c^*) \approx P(\chi^2_1 \geq c^*) \alpha.
\]
# Seja Xn a.a. de X ~ Pois(θ)# H0: θ = θ_0# H1: θ ≠ θ_0usingRandom, Distributions, StatsBase, Plots, StatsPlots, LaTeXStringsn =100θ_0 =3# Gerando sob H_0d =Poisson(θ_0)MC =10_000TX =zeros(MC)for i in1:MC x =rand(d, n) TX[i] =2* n * θ_0 -2* n *mean(x) -2* n *mean(x) *log(θ_0) +2* n *mean(x) *log(mean(x))endp =histogram(TX, normalize =true, title ="Histograma de T(X)", label ="", ylims = (0, 1), bins =20, xlabel ="T(X)", ylabel ="Densidade")plot!(Chisq(1), label = L"\chi^2_1", color =:tomato)## Probabilidade do erro tipo I, α = 10%quantil =quantile(Chisq(1), 0.9)rejeita = TX .> quantilprintln("Probilidade do Erro Tipo I com α = 10%: $(mean(rejeita) *100)%")display(p)
Probilidade do Erro Tipo I com α = 10%: 9.790000000000001%
40.7.4 Hipótese Linear Geral
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim f_\theta, \theta \in \Theta \subseteq \mathbb{R}^p\). Considere \[
\begin{cases}
\mathcal{H}_0 : C \cdot \theta = d \\
\mathcal{H}_1 : C \cdot \theta \neq d
\end{cases}
\]
em que \(C\) é uma matriz \(s \times p\) conhecida e \(d\) é um vetor de dimensão \(s\) conhecido. Podemos escrever as hipóteses em termos de \(\Theta_0\) e \(\Theta_1\):
Seja \(\hat{\theta}\) um estimador para “\(\theta\)” assintoticamente normal, ou seja, \[
\sqrt{n}(\hat{\theta} - \theta) \stackrel{\mathcal{D}}{\rightarrow} N_s(\boldsymbol{0}, V_{\theta})
\] Se \(C\) tiver posto linha completo, ou seja, todas suas linhas são linearmente independentes, então \[
\begin{aligned}
\sqrt{n}(C\hat{\theta} - C\theta) &\stackrel{\mathcal{D}}{\rightarrow} N_s(\boldsymbol{0}, C V_\theta C) \\
\Rightarrow n(C\hat{\theta} - C\theta)^T [C V_{\hat{\theta}} C^T]^{-1} (C\hat{\theta} - C\theta) &\stackrel{\mathcal{D}}{\rightarrow} \chi^2_{s}, \forall \theta \in \Theta.
\end{aligned}
\] Sob \(\mathcal{H}_0, C\theta = d\). Disso, temos que \[
n(C\hat{\theta} - d)^T [C V_{\hat{\theta}} C^T]^{-1} (C\hat{\theta} - d) \stackrel{\mathcal{D}}{\rightarrow} \chi^2_{s}.
\]
A estatística de Wald é definida por \[
W(\boldsymbol{X}_n) = n(C\hat{\theta}(\boldsymbol{X}_n) - d)^T [C V_{\hat{\theta}(\boldsymbol{X}_n)} C^T]^{-1} (C\hat{\theta}(\boldsymbol{X}_n) - d).
\]
Sob \(\mathcal{H}_0\), \(W \stackrel{\mathcal{D}}{\rightarrow} \chi^2_s\), em que \(s\) é o número de linhas de \(C\).
O teste usando a estatística de Wald é definido por \[
\delta_{W}(\boldsymbol{x}_n) = \begin{cases}
0,\ \ \ W(\boldsymbol{x}_n) < \eta \\
1,\ \ \ W(\boldsymbol{x}_n) \geq \eta
\end{cases}
\] em que \(\eta\) é obtido de \[
P(\chi^2_s \geq \eta) = \alpha
\] para um teste de Wald de tamanho \(\alpha\).
Relação com as hipóteses
Sob \(\mathcal{H}_0\), esperamos que \(W\) seja “pequeno”, enquanto sob \(\mathcal{H}_1\), esperamos que \(W\) seja “grande”.
40.7.6 Estatística Escore (ou de Rao)
Considere as hipóteses \[
\begin{cases}
\mathcal{H}_0 : \theta = \theta_0 \\
\mathcal{H}_1 : \theta \neq \theta_0
\end{cases}
\] em que \(\theta_0\) é conhecido e \(\theta \in \theta \subseteq \mathbb{R}^p\). A estatística escore é definida por
\[
R(\boldsymbol{X}_n) = U_n(\boldsymbol{X}_n, \theta_))^T I_n(\theta_0)^{-1} U_n(\boldsymbol{X}_n, \theta_0)
\] em que \(U_n\) é o escore da amostra e \(I_n\) é a informação de fisher total.
Pode-se demonstrar que \[
R \stackrel{\mathcal{D}}{\rightarrow} \chi^2_p,\ \text{sob}\ \mathcal{H}_0
\]
O teste usando a estatística escore é definido por \[
\delta_{R}(\boldsymbol{x}_n) = \begin{cases}
0,\ \ \ R(\boldsymbol{x}_n) < \eta \\
1,\ \ \ R(\boldsymbol{x}_n) \geq \eta
\end{cases}
\] em que \(\eta\) é obtido de \[
P(\chi^2_p \geq \eta) = \alpha
\] para um teste escore de tamanho \(\alpha\).
40.7.7 Comparando as estatísticas
# Razão de verossimilhanças# Seja Xn a.a. de X ~ Pois(θ)# H0: θ = θ_0# H1: θ ≠ θ_0usingRandom, Distributions, StatsBase, Plots, StatsPlots, LaTeXStringsRandom.seed!(96)n =100α =0.1MC =10_000# Razão de verossimilhançasfunctionrazao(dist, θ_0) TX =zeros(MC)for i in1:MC x =rand(dist, n) TX[i] =2* n * θ_0 -2* n *mean(x) -2* n *mean(x) *log(θ_0) +2* n *mean(x) *log(mean(x))endreturn TXend# Estatística de Waldfunctionwald(dist, θ_0) C =1 d = θ_0 W =zeros(MC)for i in1:MC x =rand(dist, n) V =mean(x) # theta =emv> mean(x) W[i] = n * (C *mean(x) - d)^2/ Vendreturn Wend# Estatística de Escorefunctionescore(dist, θ_0)I(θ) = n / θ R =zeros(MC)for i in1:MC x =rand(dist, n)U(θ) =sum(x) / θ - n R[i] =U(θ_0)^2/I(θ_0)endreturn Rend
Geraremos sob \(\mathcal{H}_0\):
# Gerando sob H_0θ_0 =3dist =Poisson(θ_0)distassin =Chisq(1)quantil =quantile(distassin, 1- α)## Probabilidade do erro tipo I, α = 10%, RazãoTX =razao(dist, θ_0)rejeita = TX .> quantilprintln("Probilidade do Erro Tipo I com α = 10% (Razão de Ver.):$(mean(rejeita) *100)%")## Probabilidade do erro tipo I, α = 10%, WaldW =wald(dist, θ_0)rejeita = W .> quantilprintln("Probilidade do Erro Tipo I com α = 10% (Wald):$(mean(rejeita) *100)%")## Probabilidade do erro tipo I, α = 10%, WaldR =escore(dist, θ_0)rejeita = R .> quantilprintln("Probilidade do Erro Tipo I com α = 10% (Escore):$(mean(rejeita) *100)%")pv =histogram( TX, normalize =true, title ="Histograma da Razão de Ver.", label ="", ylims = (0, 1), bins =20, xlabel ="T(X)", ylabel ="Densidade")plot!(Chisq(1), label = L"\chi^2_1", color =:tomato)pw =histogram( W, normalize =true, title ="Histograma de Wald", label ="", ylims = (0, 1), bins =20, xlabel ="W(X)", ylabel ="Densidade")plot!(Chisq(1), label = L"\chi^2_1", color =:tomato)pr =histogram( R, normalize =true, title ="Histograma de Escore", label ="", ylims = (0, 1), bins =20, xlabel ="R(X)", ylabel ="Densidade")plot!(Chisq(1), label = L"\chi^2_1", color =:tomato)l =@layout [pv pw; pr]plot(pv, pw, pr, layout = l)
Probilidade do Erro Tipo I com α = 10% (Razão de Ver.):
9.74%
Probilidade do Erro Tipo I com α = 10% (Wald):
10.02%
Probilidade do Erro Tipo I com α = 10% (Escore):
10.05%
Para comparar, podemos também gerar sob \(\mathcal{H}_1\):
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim f_\theta, \theta \in \Theta \subseteq \mathbb{R}^p\). Considere \[
\mathcal{H}_0: \theta \in \Theta_0
\]
Suficiência da hipótese nula para o valor-\(p\)
A hipótese alternativa, \(\mathcal{H}_1\), não é necessária para formular o valor-\(p\).
Seja \(T_{\mathcal{H}_0}(\boldsymbol{X}_n)\) tal que, quanto maior for seu valor observado, maior é a discrepância entre \(\mathcal{H}_0\) e os dados observados. Podemos usar a estatística da razão de verossimilhanças, Wald, ou de Escore. O valor-\(p\) é definido por
O valor-\(p\) é a probabilidade de observar uma estatística tão ou mais extrema que a observada sob o cenário mais favorável à \(\mathcal{H}_0\).
Notação em alguns textos
Alguns livros, para fins didáticos, definem o valor-\(p\) como probabilidade condicional: \[
\mathrm{valor-}p(\boldsymbol{x}_n, \mathcal{H}_0) - \sup_{\theta \in \Theta_0}
P_\theta(T_{\mathcal{H}_0}(\boldsymbol{X}_n) \geq T_{\mathcal{H}_0}(\boldsymbol{x}_n) | \mathcal{H}_0)
\]
Isto, na estatística clássica, está equivocado uma vez que \(\mathcal{H}_0\) é uma hipótese científica, não um evento definido na \(\sigma\)-álgebra, isto é, \(P(A|B)\) só está bem definido se, e somente se, \(A\) e \(B\) estiverem na mesma \(\sigma\)-álgebra.
Observe que, quanto menor for o valor-\(p\), há mais evidencias de que \(\mathcal{H}_0\) é falsa.
Interpretação com níveis de significância
Caso \(\mathrm{valor-}p(\boldsymbol{x}_n, \mathcal{H}_0) \leq \alpha\), então dizemos que há evidências para rejeitar \(\mathcal{H}_0\) a \(\alpha \cdot 100\%\) de significância estatística.
Se \(T_{\mathcal{H}_0} \sim G\), sob \(\mathcal{H}_0\), em que \(G\) não depende de “\(\theta\)”, então \[
\mathrm{valor-}p (\boldsymbol{x}_n, \mathcal{H}_0) = P(G \geq T_{\mathcal{H}_0}(\boldsymbol{x}_n))
\]
Se \(T_{\mathcal{H}_0} \sim G\), sob \(\mathcal{H}_0\), em que \(G\) não depende de “\(\theta\)”, então \[
\mathrm{valor-}p(\boldsymbol{X}_n,\mathcal{H}_0) \stackrel{\mathrm{Sob}\ \mathcal{H}_0}{\sim} \mathrm{Unif}(0,1)
\]
40.7.8.1 Valor-\(p\) assintótico
Seja \(T_{\mathcal{H}_0}\) uma estatística tal que \[
T_{\mathcal{H}_0} \stackrel{\mathcal{D}}{\rightarrow} G,\ \ \text{Sob}\ \mathcal{H}_0.
\] então, o valor-\(p\) assintótico é definido por \[
\mathrm{valor-}p^{(a)} (\boldsymbol{x}_n, \mathcal{H}_0) = P(G \geq T_{\mathcal{H}_0}(\boldsymbol{x}_n)
\]
Pode-se conduzir simulações de Monte Carlo para verificar se o tamanho amostral é grande o suficiente para fazer a aproximação assintótica:
Observe que \(T_{\boldsymbol{H}_0}(\boldsymbol{x}_n) = n\bar{X}^2\) (essa também é a estatística de Wald) satisfaz o critério que, quanto maior o valor observado de \(T_{\boldsymbol{H}_0}\), mais evidencias contra \(\mathcal{H}_0\). Além disso, sob \(\mathcal{H}_0\),
Se \(n = 10\) e \(\bar{x} = 1\), então \[
\mathrm{valor-}p(\boldsymbol{x}_n, \mathcal{H}_0) = P(\chi^2_1 \geq 10 \cdot 1^2) = 0.001
\]
40.7.8.3 Exemplo (Poisson)
Seja \(\boldsymbol{X}_n\) a.a. de \(X \sim \mathrm{Pois}(\theta), \theta \in \Theta = (0,\infty)\). Considere \[
\mathcal{H}_0: \theta = 1.
\]
Encontre o valor-\(p\) assintótico utilizando as três estatísticas (Razão de Verossimilhanças, Wald e Escore, \(T'_{\mathcal{H}_0}(\boldsymbol{X}_n), T''_{\mathcal{H}_0}(\boldsymbol{X}_n), T'''_{\mathcal{H}_0}(\boldsymbol{X}_n)\)).
40.7.8.3.1 Resposta
Para a razão de verossimilhanças, \[
\begin{aligned}
T'_{\mathcal{H}_0}(\boldsymbol{X}_n) &= 2 n \cdot 1 - 2 n \bar{X} - 2 n \bar{X} \ln \frac{1}{\bar{X}} \\
&= 2n - 2n\bar{X} + 2n\bar{X}\ln\frac{1}{\bar{X}} \stackrel{\mathcal{D}}{\rightarrow} \chi^2_1,\ \ \theta = 1.
\end{aligned}
\]
Para a estatística de Wald, usaremos \(\hat{\theta} = \bar{X}\) (que é o EMV, EMM e ENVVUM)
Para a estatística de escore, temos que o escore é dado por \[
U_n(\boldsymbol{X}_n, \theta) = -n + \frac{1}{\theta_0} \sum X_i
\] e a Informação de Fisher Total por \[
I_n(\theta_0) = -E_\theta\left(-\sum \frac{X_i}{\theta_0} \right) = \frac{n}{\theta_0},
\] portanto, \[
\begin{aligned}
T'''_{\mathcal{H}_0} (\boldsymbol{X}_n) &= \left(\frac{\sum X_i}{\theta_0} - n \right)^2 \cdot \frac{\theta_0}{n} \\
&= n \frac{(\bar{X} - \theta_0)^2}{\theta_0} = n(\bar{X} - 1)^2.
\end{aligned}
\]
Vamos aumentar o tamanho da amostra (\(n = 1000\) para visualizarmos a convergência do valor \(p\) em distribuição uniforme:
n =1000p1 = @. ccdf(Chisq(1), razao(Poisson(1), 1))p2 = @. ccdf(Chisq(1), wald(Poisson(1), 1))p3 = @. ccdf(Chisq(1), escore(Poisson(1), 1))hist1 =histogram( p1, title ="Valores-P da Razão de Ver.", label ="", normalize =true)hist2 =histogram( p2, title ="Valores-P da Wald", label ="", normalize =true)hist3 =histogram( p3, title ="Valores-P da Escore", label ="", normalize =true)plot(hist1, hist2, hist3, layout = l)
Na distribuição Poisson, espera-se que, com valores pequenos de \(\theta\), a aproximação piore pela assimetria. Vejamos com \(\theta_0 = 0.01, n=100\):
n =100p1 = @. ccdf(Chisq(1), razao(Poisson(0.01), 0.01))p2 = @. ccdf(Chisq(1), wald(Poisson(0.01), 0.01))p3 = @. ccdf(Chisq(1), escore(Poisson(0.01), 0.01))hist1 =histogram( p1, title ="Valores-P da Razão de Ver.", label ="", normalize =true)hist2 =histogram( p2, title ="Valores-P da Wald", label ="", normalize =true)hist3 =histogram( p3, title ="Valores-P da Escore", label ="", normalize =true)plot(hist1, hist2, hist3, layout = l)
Se \(\Sigma\) for conhecido o vetor de parâmetros é \(\theta = \boldsymbol{\mu}\).
Pode-se utilizar as estatísticas de razão de verossimilhanças, Wald e Escore para testar as hipóteses. Todas essas estatísticas convergem para \(\chi^2_p\).o