# Formula For Confidence Interval of Two Samples With Unequal Variances

1. Mar 5, 2013

### Soaring Crane

Are there any online sources that would note (and define all variables, especially on how to calculate standard error) in the formula for calculating the confidence interval, a complement to the t-test, of two independent samples with unequal variances? (I want to see exactly how software/graphing calculators are giving me upper and lower limit values.)

Thank you.

2. Mar 6, 2013

### Staff: Mentor

You want to combine those two samples?
Let $\mu_i$, $\sigma_i^2$ be the mean and variance of measurement i.
The optimal combination can be obtained as a weighted average with the inverse variance as weights:

$$\mu = \frac{1}{\sigma_1^{-2}+\sigma_2^{-2}}\left(\frac{\mu_1}{\sigma_1^2} +\frac{\mu_2}{\sigma_2^2}\right)$$
$$\sigma^2 = \frac{1}{\sigma_1^{-2}+\sigma_2^{-2}}$$

This is just regular error propagation (assuming Gaussian distributions), and the weights are chosen to minimize $\sigma$. You can check this yourself, if you like, there is no need to look for any reference. I did not check the second formula, but I think it is correct.

If you want to compare the samples, calculate the difference, and see if it is compatible with 0.

Last edited: Mar 6, 2013
3. Mar 6, 2013

### ImaLooser

Confidence interval for what? Difference of the sample means? It could be anything.

4. Mar 6, 2013

### Soaring Crane

ImaLooser,

I apologize. It would be the confidence interval for the mean difference (difference of the sample means) in the case where the population variances are unknown. For example, I know the formula for calulating the t-score for the t-test with unequal variances:

t = (mean difference)/(standard error),

where standard error = sqrt{[(s_1)^2/(n_1)^2] + [(s_2)^2/(n_2)^2]}

s = standard deviation
n = sample size

I wanted the formula for the confidence interval as a check for the t-test results.

Thank you.

5. Mar 6, 2013

### Staff: Mentor

Those confidence intervals are just multiples of the standard deviation - again, assuming Gaussian distributions.

6. Mar 7, 2013

### ImaLooser

I haven't done any of this for over fifteen years, but I believe you are correct. The variance of the difference in sample means is equal to the sum of the two sample variances. Take the square root to get the standard error. A 95% confidence interval is then [u - 1.97s, u + 1.97s] where u is the difference in sample means.