How to Create a Confidence Interval for the Difference of Two Means with Unknown Standard Deviations and/or Small Sample Sizes
You can find a confidence interval (CI) for the difference between the means, or averages, of two population samples, even if the population standard deviations are unknown and/or the sample sizes are small. The goal of many statistical surveys and studies is to compare two populations, such as men versus women, low versus high income families, and Republicans versus Democrats. When the characteristic being compared is numerical (for example, height, weight, or income), the object of interest is the amount of difference in the means (averages) for the two populations.
For example, you may want to compare the difference in average age of Republicans versus Democrats, or the difference in average incomes of men versus women. You estimate the difference between two population means,
by taking a sample from each population (say, sample 1 and sample 2) and using the difference of the two sample means
plus or minus a margin of error. The result is a confidence interval for the difference of two population means,
There are two situations where you cannot use z* when computing the confidence interval. The first of which is if you not know
In this case you need to estimate them with the sample standard deviations, s_{1} and s_{2}. The second situation is when the sample sizes are small (less than 30). In this case you can’t be sure whether your data came from a normal distribution.
In either of these situations, a confidence interval for the difference in the two population means is
where t* is the critical value from the tdistribution with n_{1} + n_{2} – 2 degrees of freedom; n_{1} and n_{2} are the two sample sizes, respectively; and s_{1} and s_{2} are the two sample standard deviations. This t*value is found on the following ttable by intersecting the row for df = n_{1} + n_{2} – 2 with the column for the confidence level you need, as indicated by looking at the last row of the table.
To calculate a CI for the difference between two population means, do the following:

Determine the confidence level and degrees of freedom (n_{1} + n_{2} – 2) and find the appropriate t*value.
Refer to the above table.

Identify
Identify

Find the difference,
between the sample means.

Calculate the confidence interval using the equation,
Suppose you want to estimate with 95% confidence the difference between the mean (average) lengths of the cobs of two varieties of sweet corn (allowing them to grow the same number of days under the same conditions). Call the two varieties Cornestats (group 1) and Statsosweet (group 2). Assume that you don’t know the population standard deviations, so you use the sample standard deviations instead — suppose they turn out to be s_{1} = 0.40 and s_{2} = 0.50 inches, respectively. Suppose the sample sizes, n_{1} and n_{2}, are each only 15.

To calculate the CI, you first need to find the t*value on the tdistribution with (15 + 15 – 2) = 28 degrees of freedom. Using the above ttable, you look at the row for 28 degrees of freedom and the column representing a confidence level of 95% (see the labels on the last row of the table); intersect them and you see t*_{28} = 2.048.

For both groups, you took random sample of 15 cobs, with the Cornestats variety averaging 8.5 inches, and Statsosweet 7.5 inches. So the information you have is:

The difference between the sample means
is 8.5 – 7.5 = +1 inch. This means the average for Cornestats minus the average for Statsosweet is positive, making Cornestats the larger of the two varieties, in terms of this sample. Is that difference enough to generalize to the entire population, though? That’s what this confidence interval is going to help you decide.

Using the rest of the information you are given, find the confidence interval for the difference in mean cob length for the two brands:
Your 95% confidence interval for the difference between the average lengths for these two varieties of sweet corn is 1 inch, plus or minus 0.9273 inches. (The lower end of the interval is 1 – 0.9273 = 0. 0727 inches; the upper end is 1 + 0. 9273 = 1. 9273 inches.) Notice all the values in this interval are positive. That means Cornestats is estimated to be longer than Statsosweet, based on your data.
The temptation is to say, “Well, I knew Cornestats corn was longer because its sample mean was 8.5 inches and Statosweet was only 7.5 inches on average. Why do I even need a confidence interval?” All those two numbers tell you is something about those 30 ears of corn sampled. You also need to factor in variation using the margin of error to be able to say something about the entire populations of corn.