Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The two sample t-test is based on the t-distribution and is exact when sigma_1 =

ID: 3251943 • Letter: T

Question

The two sample t-test is based on the t-distribution and is exact when sigma_1 = sigma_2. However, when sigma_1 notequalto sigma_2 the use of a t-distribution with v degrees of freedom is an approximation. Here, v = (s^2_1/n_1 + s^2_2/n_2)^2/(s^2_1/n_1)^2/n_1 - 1 + (s^2_2/n_2)^2/n_2 - 1. In this question, you are to carry out simulation experiments that explore the validity of this approximation. Take n_1 = 10, n_2 = 10, and assume (under H_0) that Xi ~ N(0, 0.7^2) and Y_i ~ N(0, 1.3^2). (a) Calculate, v = (sigma^2_1/n_1 + sigma^2_2/n_2)^2/sigma^2_1/n_1)^2/n_1 - 1 + (sigma^2_2/n_2)^2/n_2 - 1. (b) Generate 10^6 replicates of the random variable T= X bar - Y bar/squareroot S^2_1/n_1 + S^2_2/n_2. Note that each generation of T requires 10 X's and 10 Y's. (c) Compare the 0.8, 0.9 and 0.95 quantiles of a t-distribution with v degrees of freedom and the empirical quantiles obtained from the simulation. (d) Explain your results and comment about this simulation experiment. Are there other ways to carry it out?

Explanation / Answer

The R code for the simulation is given by:

t=array(dim=1)
for (i in 1:10^6)
{
x=rnorm(10,0,0.7)
y=rnorm(10,0,1.3)
t[i]=(mean(x)-mean(y))/sqrt(var(x)/10+var(y)/10)
}
quantile(t,c(0.8,0.9,0.95))
v=(0.7^2/10+1.3^2/10)^2/((0.7^2/10)^2/9+(1.3^2/10)^2/9)
qt(c(0.8,0.9,0.95),ceiling(v))

We find that the empirical quantiles do match with the theoritical quantiles.

Thus we can conclude that the assumption is correct.

Another way of carrying this out is to perform the non-parametric median test on the median of the sample and the theoretical median and we can justify the assumption thereafter.