https://www.youtube.com/watch?v=lQx0mYMQ5C8&list=PLsri7w6p16vuFEiIVqKFwbB8MlHesFlEM&index=2&t=0s
================================================================================
================================================================================
Weight in kg
Before taking drug
After taking drug
$$$H_0$$$:no weight change --meaning--> $$$\bar{x}_{\text{before}}-\bar{x}_{\text{after}}=0$$$
$$$H_1$$$:weight change --meaning--> $$$\bar{x}_{\text{before}}-\bar{x}_{\text{after}}\ne 0$$$
================================================================================
$$$\bar{x}_1$$$: before drug
$$$\bar{x}_2$$$: after drug
$$$n$$$: number of sample
$$$x_1-x_2=d_x$$$
Before and after at each period
$$$\bar{d}_x = \frac{\sum\limits (x_1-x_2)}{n}$$$
Before and after for entire period
$$$S_{d_x}^2 = \dfrac{\sum\limits(d_x-\bar{d}_x)^2}{n-1}$$$
Variance
$$$S_{d_x} = \sqrt{S_{d_x}^2} = \sqrt{\dfrac{\sum\limits(d_x-\bar{d}_x)^2}{n-1}}$$$
Std
$$$s_{\bar{d}_x} = \frac{S_{d_x}}{\sqrt{n}}$$$
================================================================================
Let's calculate
$$$\bar{d}_x = \dfrac{(75-73)+(74-74)+\cdots+(68-67)}{30} = 3.90$$$
$$$S_{d_x}^2 = \dfrac{(2-3.9)^2+(0-3.9)^2+\cdots+(1-3.9)^2}{30-1} = 13.197$$$
$$$S_{d_x} = \sqrt{13.197} = 3.633$$$
$$$s_{\bar{d}_x} = \frac{3.633}{\sqrt{30}}$$$
================================================================================
test hypothesis
p value=0.05
degree of freedom = 29
$$$t_{(29,0.025)} = 2.045$$$
$$$d_x-t_{(n-1,\frac{\alpha}{2})} \times \frac{S_{d_x}}{\sqrt{n}} \le t \le d_x+t_{(n-1,\frac{\alpha}{2})} \times \frac{S_{d_x}}{\sqrt{n}}$$$
$$$2.9 - 2.045 \times \frac{3.633}{\sqrt{30}} \le t \le 2.9 + 2.045 \times \frac{3.633}{\sqrt{30}}$$$
$$$2.544 \le t \le 5.256$$$
$$$t = \dfrac{d_x}{\frac{s_{d_x}}{\sqrt{n}}} = \frac{3.9}{0.663} = 5.880$$$
Red areas: rejection area
$$$H_0$$$ is rejected