Hypothesis Testing: One and Two-Sided Tests

hypothesis testingprobabilitystatistical-inferencestatistics

The general rule of hypotheses chosen for testing difference in means of two groups $x$ and $y$ is to choose the follwoing:

$H_0: \mu_x = \mu_y$, $H_1: \mu_x \neq \mu_y$

A $t$-test is then conducted to examine whether the null hypothesis is rejected. However, what is the hypothesis testing design when instead the hypothesis is the following:

$H_0: \mu_x \leq \mu_y$, $H_1: \mu_x > \mu_y$.

Any standard testing procedures that somebody can point to would be helpful.

Best Answer

Here is an example, with 20 normal observations in each of two groups.

sort(x1)
 [1]  73  78  80  89  90  90  90  93  94  94 100 100 106 109 112 120 123 124 128 139
sort(x2)
 [1]  64  65  75  76  77  77  79  80  83  86  89  93  94  95 100 100 102 105 115 117

Boxplots (sample 1 on the bottom)

enter image description here

Testing $H_0: \mu_1 \le \mu_2$ against $H_a: \mu_1 > \mu_2$ with a Welch (separate variances) two-sample t-test, we obtain the P-value 0.018, and so we can reject $H_0$ at the 2% level of significance (results from R statistical software):

t.test(x1, x2)

        Welch Two Sample t-test

data:  x1 and x2
t = 2.4783, df = 36.793, p-value = 0.01791
alternative hypothesis: true difference in means is not equal to 0  
sample estimates:
mean of x mean of y 
    101.6      88.6 

Testing $H_0: \mu_1 \ge \mu_2$ against $H_a: \mu_1 < \mu_2$ with the same procedure in R (except for the parameter alte="greater"), we obtain the P-value 0.009, and so we can reject $H_0$ at the 1% level of significance. Notice that the P-value is half as large as for the two-sided test.

t.test(x1, x2, alte="greater")

        Welch Two Sample t-test

data:  x1 and x2
t = 2.4783, df = 36.793, p-value = 0.008957
alternative hypothesis: true difference in means is greater than 0
sample estimates:
mean of x mean of y 
    101.6      88.6 

If we test $H_0: \mu_1 \le \mu_2$ against $H_a: \mu_1 > \mu_2$ we obtain the P-value greater than 1/2. We cannot reject here because sample means are $\bar X_1 = 101.6 > \bar X_2 = 88.6.$ So (as mentioned by @PhilH) we obviously have no reason to believe that populations means would have $\mu_1 > \mu_2.$

t.test(x1, x2, alte="less")

        Welch Two Sample t-test

data:  x1 and x2
t = 2.4783, df = 36.793, p-value = 0.991
alternative hypothesis: true difference in means is less than 0
sample estimates:
mean of x mean of y 
     101.6      88.6 

Notes: (a) Notice that whether the test is one-sided or two-sided, the null hypothesis must always contain an $=$-sign (as $=, \le,$ or $\ge$). (b) The Welch two-sample t test is generally preferred over the 'pooled' two-sample t test because it does not make the assumption that population variances are equal. For these data the pooled test would give similar results, but you'd have df = 38. [In R you can get a pooled test by using the parameter var.eq=T.] (c) I have edited the R output slightly for relevance, but not changed any of the numbers. (d) Most statistical software and statistical calculators will do both one-sided and two-sided tests. In each case, look for the way to specify what kind of test you want. [In R, it's the parameter alte (or alternative].

Related Question