# Help me conduct a paired data t-test for the problem in the picture!

*print*Print*list*Cite

### 1 Answer

We have the paired fuel consumptions (in miles/gal) for each car:

city 18 22 21 21

highway 26 31 29 29

It is well known that fuel consumption in the city is worse (fewer miles to the gallon) than on highways, since the motorist keeps stopping and starting in traffic and the car is further away from its most optimal speed for efficiency.

Hence, I would say that it is sensible here to perform a one-sided test that the highway consumption is better (more miles to the gallon) than the city consumption. Nevermind that this is a very small sample. In data analysis, common sense is a very important element.

We have then the differences d:

8 9 8 8

The average of d, bar(d) = 33/4 = 8.25

The standard deviation of d, s_d = sqrt((3*(8-8.25)^2 + (9-8.25)^2)/(n-1))=

sqrt(0.75/3) = 0.5 (since the number of data n = 4)

To calculate the t statistic T we subtract the value of the mean under the null hypothesis that the fuel consumptions are the same (mu = 0) from the sample estimate, bar(d) = 8.25, and divide by the standard deviation of bar(d) = s_d/sqrt(n) = 0.5/2 = 0.25

Therefore T = 8.25/0.25 = 33

The critical value to compare this with (at the 0.05 level of significance)

is the 95th percentile of the t distribution where the number of degrees of freedom is n - 1 = 3:

c = 2.35

Our test statistic T = 33 is clearly much larger than this, so the null hypothesis is rejected at the 0.05 level of significance.

In fact, a one-sided p-value associated with this value is 3.06e-05, so the null would be rejected even at the 0.0001 level of significance.

We can conclude that we are at least 95% certain that the fuel consumption when driving on highways is better than that when driving in cities.

(If you did want to perform a two-sided test, the two-sided critical value would be the 97.5th percentile of the t distribution with 3 df: 3.18 - the null is also rejected in this case).

Incidentally, this test can be performed in the free statistics software R using

t.test(highway,city,alternative="greater",paired=TRUE)

**ANSWER**

**a) sample mean `bar(d) = 8.25` **

**b) standard dev of differences `s_d = 0.5` **

**c) test statistic `T = 33` **

**d) critical value (for one-sided test) `c_(0.95) = 2.35` **, `c_0.95 = pm 3.18` **(for two-sided test)**