Tests if the difference of two population means \(\mu_d = \mu_1 - \mu_2\) differ from a value \(d_0\) in the case that observations are collected in pairs.
\(X_1\) follows Gaussian distributions with \(\mu_1\) and variance \(\sigma_1^2\). \(X_2\) follows Gaussian distributions with \(\mu_2\) and variance \(\sigma_2^2\). The covariance of \(X_1\) and \(X_2\) is \(\sigma_{12}\).
The standard deviations are unknown. The standard deviation \(\sigma_d\) of the differences is estimated through the population standard deviation \(S_d\) of the differences.
\[T = \frac{\bar{D} - d_0}{\sigma_d}\sqrt{S_d}\] with \[S_d = \sqrt{\frac{1}{n-1}\sum_{i=1}^n (D_i - \bar{D})^2}\]
\[\bar{D} = \frac{1}{n}\sum_{i=1}^n D_i\] and \(D_i = X_{1i} - X_{2i}\), \(i = 1,...,n\)
Rejection \(H_0\) if for the observed value t of T:
\(t \lt t_{\alpha/2, n-1}\) or \(t \gt t_{1-\alpha/2, n-1}\)
\(t \gt t_{1-\alpha, n-1}\)
\(t \lt t_{\alpha,n-1}\)
\(\rho = 2P(T \le (-|t|))\)
\(\rho = 1 - P(T \le t)\)
\(\rho = P(T \le t)\)
To test if the mean intelligence quotient increases by 10 comparing before training (IQ1) and after training (IQ2). Note: Because we are interested in a negative difference of means of \(IQ1 - IQ2\), we must test against \(d_0 = -10\)
#iq dataset
no <- seq(1:20)
IQ1 <- c(127, 98,105,83,133,90,107,98,91,100,88,96,110,87,88,88,105,95,79,106)
IQ2 <- c(137, 108,115,93,143,100,117,108,101,110,98,106,120,97,98,100,115,111,89,116)
iq <-data.frame(no,IQ1, IQ2)
t.test(iq$IQ1,iq$IQ2,mu=-10,alternative="two.sided",paired=TRUE)
##
## Paired t-test
##
## data: iq$IQ1 and iq$IQ2
## t = -1.2854, df = 19, p-value = 0.2141
## alternative hypothesis: true difference in means is not equal to -10
## 95 percent confidence interval:
## -11.051338 -9.748662
## sample estimates:
## mean of the differences
## -10.4