Lesson 89 – The One-Sample Sign Test

Hypothesis Tests – Part IV

H_{0}: P(X > \mu) = 0.5

H_{A}: P(X > \mu) > 0.5

H_{A}: P(X > \mu) < 0.5

H_{A}: P(X > \mu) \neq 0.5

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 \bar{x} as 26.69 MPG, which he compares with EPA’s rating — \mu of 26 MPG. The test statistic t_{0} is 0.52.

His alternate hypothesis is \mu < 26 MPG against the null hypothesis of \mu \ge 26 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 \mu. It works well when there are outliers in the data.

Joe has to establish the following null hypothesis.

H_{0}: P(X > 26) = 0.5

If H_{0} is true, about half of the values of sample X will be greater than 26 MPG, and about half of them will be less than 26 MPG. In other words, the sample data will be dispersed around \mu with equal likelihood.

To this null hypothesis, he will cast an alternate hypothesis

H_{A}: P(X > 26) < 0.5

If H_{A} 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, S^{+}, is the test statistic for the sign test.

In a sample of eight (n = 8), S^{+}=5.

S^{+} could have been 0, 1, 2, 3, 4, 5, 6, 7, or 8.

Under the null hypothesis, S^{+} 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 S^{+} values on the x-axis and P(S^{+}=k) on the y-axis. The null distribution is the distribution of the probability that S^{+} can be 0, 1, 2, …, or 8. For n = 8 and p = 0.5.

P(S^{+}=k) = {8 \choose k} p^{k}(1-p)^{8-k}

For instance, P(S^{+}=0) = {8 \choose 0} p^{0}(1-p)^{8-0} = 0.0039

Here is the full binomial table.

Now, since the sample yields S^{+}=5, p-value for this test is the probability of finding up to five positives — P(S^{+} \le 5).

P(S^{+} \le 5)=\sum_{x=0}^{x=5} {8 \choose x} p^{x}(1-p)^{8-x}=0.8555

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.

H_{0}: P(X > 36) = 0.5

H_{A}: P(X > 36) < 0.5

If H_{0} 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 H_{A} 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 S^{+}=7 out of 23 values (n = 23). The p-value for the test is then the probability of seeing value for S^{+} of up to 7 in a binomial distribution with n = 23 and p = 0.5.

P(S^{+} \le 7)=\sum_{x=0}^{x=7} {23 \choose x} p^{x}(1-p)^{23-x}=0.046

Since the p-value is less than \alpha, 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 t_{0} falls in the rejection region, i.e., t_{0}<t_{critical}, or the p-value is less than \alpha.

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?

\bar{x} and s will be 33.875 MPG and 6.099 MPG respectively.

The test statistic t_{0} will be -1.706.

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

Since t_{0}>t_{critical}, 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 S^{+} will still be seven and the p-value P(S^{+} \le 7) 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.

error

Enjoy this blog? Please spread the word :)