# Keeping getting wrong answer calculating confidence intervals

I was given the following:

A sample of 16 domestic cars is made whose average fuel economy is 30.313 and a standard deviation of 4.7583.

A sample of 10 imported cars is made whose average fuel economy is 32.012 with a standard deviation of 8.878.

Find a 95% confidence interval for the difference between the two means.

I attempted to do the calculation but but my answer was incorrect and the online homework system said the answer was (-7.192, 3.794)

What I did was the formula $t_{\frac{\alpha}{2}}$ $\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}$ for the margin of error. I was a little unsure of what degrees of freedom I should use but i noticed by looking at the table there was not a single value on the table that would get me the answer the system said. the $t$ value would have to be 1.801518 and the limiting value of the $t$ is the $z$ value of 1.96. So am I using the wrong formula or is the system just wrong? I looked at a few other problems I war marked incorrect for saw similar things.

• I think that 95% CI would be what you would get if you did a two-sample t test with equal variances. Your formula, however, is for unequal variances. What did you your calculation yield? – Dimitriy V. Masterov Oct 28 '16 at 1:02
• The value I got for the square root part of it was 2.106. I have heard different things about the right number of degrees of freedom,I think the rule in this case would be the smaller of $n_1 -1$ and $n_2 -1$ which would be 9 in this case. That gives a $t$ value of 2.262. Then the CI would be (-7.220932 ,3.065) – Elliot Oct 28 '16 at 1:18
• As @DimitriyV.Masterov points out that is not the df in this case. – mdewey Oct 28 '16 at 11:12

The difference in means is $$30.313-32.012=-1.699.$$

Assuming equal variances, the pooled standard error of the difference is $$\left(\frac{(16-1) \cdot 4.7583^2+(10-1) \cdot 8.878^2}{16+10-2} \right)^{0.5} \cdot \left(\frac{1}{16}+\frac{1}{10} \right)^{0.5} = 2.66506$$

The inverse t-tail value with 24 degrees of freedom (total sample size, minus the the two means) is 2.0638986.

Putting these together means that 95% CI is $$-1.699\pm2.0638986 \cdot 2.66506=[-7.1994135,3.8014135]$$

This is near the online answer and agrees with computer:

. ttesti 16 30.313 4.7583 10 32.012 8.878

Two-sample t test with equal variances
------------------------------------------------------------------------------
|     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
x |      16      30.313    1.189575      4.7583    27.77748    32.84852
y |      10      32.012     2.80747       8.878    25.66106    38.36294
---------+--------------------------------------------------------------------
combined |      26    30.96646    1.281078    6.532243    28.32803    33.60489
---------+--------------------------------------------------------------------
diff |              -1.699     2.66506               -7.199414    3.801414
------------------------------------------------------------------------------
diff = mean(x) - mean(y)                                      t =  -0.6375
Ho: diff = 0                                     degrees of freedom =       24

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.2649         Pr(|T| > |t|) = 0.5298          Pr(T > t) = 0.7351

• Alright thank you. So the formula I used is when we dont have equal variances? – Elliot Oct 28 '16 at 14:57
• Also what is the correct df when I use the formula that I was using? – Elliot Oct 28 '16 at 16:20
• @Elliot You can find the formulas here. – Dimitriy V. Masterov Oct 28 '16 at 17:32