Hypothesis Tests – Part IV

Joe is ready to buy his first (used) car as anyone does when they are new to the whole driving experience.

After a careful search on craigslist, he narrowed down to check out a 2003 Ford Focus and a 2011 Hyundai Sonata Hybrid. He liked their specs and wanted to verify the all-important gas mileage.

While he is taking the words of the owners at face value, he also wants to check the mileage reported by the general public to the EPA.

In case you are unaware, the United States Environmental Protection Agency (USEPA) maintains a website www.fueleconomy.gov where they provide information on the fuel economy for different vehicles.

They give their rating based on standardized tests to reflect typical driving conditions and driver behavior. The public also shares their miles per gallon (MPG) estimates.

At any rate, Joe navigated through this interesting website and checked out the data that people shared for these two varieties.

Here is the data shared by eight people for the 2003 Ford Focus.

As you can see, EPA rates an average of 26 MPG for this variety.

Joe wants to check if the average mileage for this car as derived from a sample data conforms to the EPA rating or not.

Joe already knows how to do this using the one-sample t-test. So he goes about establishing the null and the alternative hypothesis, deciding on the acceptable rejection rate, computing the test statistic and its corresponding p-value.

Here is a summary of his test.

From the sample of eight vehicles, he computed as 26.69 MPG, which he compares with EPA’s rating — of 26 MPG. The test statistic is 0.52.

His alternate hypothesis is MPG against the null hypothesis of MPG. So, the critical value from the T-distribution with 7 degrees of freedom (n=8) is -1.9.

Since the test statistic is greater than the critical value, he cannot reject the hypothesis.

Until further evidence is available, he will continue to believe that the 2003 Ford Focus will have an average fuel economy of 26 MPG.

Enter the Sign Test

Joe can also perform a One-Sample Sign Test if he needs more confirmation.

The sign test determines whether a given sample X is generally larger or smaller or different than a selected value . It works well when there are outliers in the data.

Joe has to establish the following null hypothesis.

If is true, about half of the values of sample X will be greater than 26 MPG, and about half of them will be negative. In other words, the sample data will be dispersed around with equal likelihood.

To this null hypothesis, he will cast an alternate hypothesis

If is true, more than half of the values of sample X will be less than 26 MPG. In other words, the sample shows low mileages — significantly less than 26 MPG.

Look at this visual. Joe is plotting the sample data on the number line and indicating 26 MPG cutoff line along with whether the sample data is greater than 26 MPG or less than 26 MPG using a plus and a minus sign — the sign test 😉

Three vehicles from the sample had a reported mileage of less than 26 MPG. Out of the eight data points, the number of positives is five, and the number of negative is three.

The number of positives, , is the test statistic for the sign test.

In a sample of eight (n = 8), .

could have been 0, 1, 2, 3, 4, 5, 6, 7, or 8.

Under the null hypothesis, follows a binomial distribution with a probability of 0.5. We consider this as the null distribution.

Look at this visual.

It shows the possible values on the x-axis and on the y-axis. The null distribution is the distribution of the probability that can be 0, 1, 2, …, or 8. For n = 8 and p = 0.5.

For instance,

Here is the full binomial table.

Now, since the sample yields , p-value for this test is the probability of finding up to five positives — .

Since the p-value is greater than 0.05, the rejection rate Joe has decided upon; he cannot reject the null hypothesis.

If you noticed, the sign test only uses the signs of the data and not the magnitudes. So it is resistant to outliers.

What about Hyundai Sonata Hybrid

Joe quickly looks for some data on the 2011 Hyundai Sonata Hybrid. Sure enough, he finds this.

There is a sample of 24 vehicles of this type, and EPA rates this at 36 MPG.

Let’s see how Joe uses the sign test to verify if the sample data conforms to the EPA specified rating.

He first establishes the null and the alternative hypothesis.

If is true, about half of the 24 values found in the sample will be greater than 36 MPG, and about half of them will be negative.

If is true, more than half of the 24 values will be less than 36 MPG. In other words, the sample reveals a significantly lower mileage than the EPA rated 36 MPG.

Joe then plots the data on the number line to visually find the number of positive and negative signs.

He counts them as 7.

There is one number that is exactly 36 MPG. He removes this from the sample and conducts the test with 23 data points.

The test statistic is out of 23 values (n = 23). The p-value for the test is then the probability of seeing value for of up to 7 in a binomial distribution with n = 23 and p = 0.5.

Since the p-value is less than , Joe has to reject the null hypothesis that the average mileage for the 2011 Hyundai Sonata Hybrid is 36 MPG.

Why can’t Joe just conduct the t-test?

He can. Here is the result of the t-test.

The test statistic falls in the rejection region, i.e., , or the p-value is less than .

He will reject the null hypothesis test.

What about the outliers?

Suppose there is an error in entering the 21st value. Let’s say it is 48.8 MPG instead of 38.8 MPG.

How will this change the result of the t-test?

and s will be 33.875 MPG and 6.099 MPG respectively.

The test statistic will be -1.706.

At 5% rejection rate and 23 degrees of freedom, will be -1.713.

Since , Joe would not be able to reject the null hypothesis.

Whereas, if he uses the sign test for his investigation, as he is doing now, the outlier data point 48.8 MPG will still show up only as a positive sign and the resultant will still be seven and the p-value will still be 0.046.

The sign test is resistant to outliers.

If you find this useful, please like, share and subscribe.

You can also follow me on Twitter @realDevineni for updates on new lessons.