# Confidence intervals over mean difference with unknown but equal variance

The problem is the following: I have 2 Stores, called Store1 and Store2 I take a sample of the number of item sold in each store over a certain period of time

From the first store the sample has dimension 11 and has a mean of 1045 = x_bar1 and standard deviation 10 = s_1

From the second store I take a sample with dimension 9 and it has mean 1025 = x_bar2 and standard deviation 9 = s_2

I have to get a confidence interval of 95% over the difference of this two means. This is what I taught was the correct formula to get to the solution

. This is what the professor sent me as a response, telling me that my solution was wrong

I cannot understand where to derive that formula from, I think it has something to do with the fact that me don't have the acual standard deviations of the population but I cannot undestand the derivation of the formula.

I spent countless hours to try and solve this on my own, by searching online, ecc. So I'm asking for your help.

If there is something wrong with the format of this post please tell me and I will be glad to fix it.

• The first one is based on the assumption of unequal variance and normal approximation. The second one is based on the assumption of equal variance and exact t distribution. – user158565 Dec 11 '18 at 21:17

You have two independent samples: $$(X_{i1},X_{i2},\ldots,X_{in_i})\stackrel{\text{i.i.d}}\sim\mathcal N(\mu_i,\sigma^2)\quad,i=1,2$$

Analogous to the problem of testing for difference of means in two homoscedastic normal populations where we use Fisher's (exact) t-test, the confidence interval for the difference of means also involves Fisher's t-statistic as a pivot.

Define the sample means and sample variances:

$$\overline X_i=\frac{1}{n_i}\sum_{j=1}^{n_i}X_{ij}\quad,\quad S_i^2=\frac{1}{n_i-1}\sum_{j=1}^{n_i}(X_{ij}-\overline X_i)^2\qquad,\,i=1,2$$

Your parameter of interest is $$\theta=\mu_1-\mu_2$$

Then we can justify that $$\overline X_1-\overline X_2\sim \mathcal N\left(\theta,\sigma^2\left(\frac{1}{n_1}+\frac{1}{n_2}\right)\right)\tag{1}$$

Define the pooled variance

$$S^2=\frac{(n_1-1)S_1^2+(n_2-1)S_2^2}{n_1+n_2-2}$$

It then follows from the reproductive property of chi-square distribution that

$$\frac{(n_1+n_2-2)S^2}{\sigma^2}\sim\chi^2_{n_1+n_2-2}\tag{2}$$

, independent of $$\overline X_1-\overline X_2$$.

Use $$(1)$$ and $$(2)$$ to create a $$t$$ distribution.

Given $$\theta$$, you will get what is known as Fisher's t-statistic:

$$T=\frac{\overline X_1-\overline X_2-\theta}{S\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}\sim t_{n_1+n_2-2}$$

This $$T$$ is your pivot for finding a confidence interval for $$\theta$$.

Using this pivot, I get the following confidence limits for a $$100(1-\alpha)\%$$ CI for $$\theta$$:

$$\overline x_1-\overline x_2\mp (t_{\alpha/2;n_1+n_2-2})\,s\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}$$