In the frequentist approach $$\theta$$ is considered a fixed number that does not depend on the sample $$x$$. Consequently

if $$\theta \in \Theta_0$$ then $$P(\theta \in \Theta_0 | x) = P(H_0 |x) = 1$$ and $$P(\theta \in \Theta_1 | x) = P(H_1 |x) = 0$$.

if $$\theta \in \Theta_1$$ then $$P(\theta \in \Theta_0 | x) = P(H_0 |x) = 0$$ and $$P(\theta \in \Theta_1 | x) = P(H_1|x) = 1$$.

In the Bayesian approach, these probabilities depend on the sample $$x$$ and can be obtained using the posterior distribution $$\pi(\theta | x)$$, which can be calculated using Bayes theorem.

### Types of hypothesis test

#### Simple

$$H_0: \theta = \theta_0 \text{ and } H_1: \theta = \theta_1$$

$\pi(H_0 |x) = \frac{f(x|H_0) \pi(H_0 )}{f(x|H_0 ) \pi(H_0 ) + f(x|H_1) \pi(H_1 )}$

$\pi(H_1 |x) = \frac{f(x|H_1) \pi(H_1 )}{f(x|H_0 ) \pi(H_0 ) + f(x|H_1) \pi(H_1 )}$

$\text{with } \pi(H_0) + \pi(H_1) = 1$

Then

$\text{Posterior odds }=\frac{\pi(H_0 |x)}{\pi(H_1 |x)} = \frac{f(x|H_0)}{f(x|H_1 )} \frac{\pi(H_0)}{\pi(H_1)} = \text{Bayes factor x Priod odds} = B \text{ x Priod odds}$

#### Composite

$B = \frac{\int_{\Theta_0} f(x|\theta)g_0(\theta) \, d\theta}{\int_{\Theta_1} f(x|\theta)g_1(\theta) \, d\theta}$

where $$g_i(\theta)$$ is the prior distribution of $$\theta$$ under $$H_i$$.

##### Two-sides

$$H_0: \theta = \theta_0 \text{ and } H_1: \theta \neq \theta_0$$

$B = \frac{\int_{\Theta_0} f(x|\theta) \delta(\theta-\theta_0) \, d\theta}{\int_{\Theta_1} f(x|\theta)g_1(\theta) \, d\theta} = \frac{f(x|\theta_0)}{\int_{\Theta_1} f(x|\theta)g_1(\theta) \, d\theta}$

## Decision rule

In the frequentist approach, the rejection region is often specified by establishing a criterium on a test statistic $$W(x)$$ (which often is $$\Lambda(x)$$):

$R=\{x: W(x) < c\}$

In the Bayesian approach, given that $$\pi(H_0 |x)$$ and $$\pi(H_1 |x)$$ are probabilities, a natural test statistic is the posterior odds and a natural criterium is 1

$R=\left\{ x: \frac{\pi(H_0 |x)}{\pi(H_1 |x)} < 1 \right\} =\left\{ x: \pi(H_1 |x) > 1/2 \right\}$