Hypothesis tests and Stata output

Hypothesis tests and Stata output

by Jenise Wong -
Number of replies: 0

Today in lab, the question came up about Stata output for hypothesis tests (i.e. which is the right p-value to look at for a one-sided hypothesis?) and I wanted to try to elaborate further.  Using this past week's assignment as an example, you should have gotten Stata output for question 6d that looks something like this:

. ttest sleep==6.75

One-sample t test

------------------------------------------------------------------------------

Variable |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]

---------+--------------------------------------------------------------------

   sleep |     452    6.834624    .0486862    1.035084    6.738944    6.930304

------------------------------------------------------------------------------

    mean = mean(sleep)                                            t =   1.7381

Ho: mean = 6.75                                  degrees of freedom =      451 

   Ha: mean < 6.75             Ha: mean != 6.75               Ha: mean > 6.75

 Pr(T < t) = 0.9586         Pr(|T| > |t|) = 0.0829          Pr(T > t) = 0.0414

In this example, your null hypothesis was that the mean was greater than or equal to 6.75 and the alternative was that it was less than 6.75.  However, because of the way we set up the command (ttest sleep==6.75) the null hypothesis for Stata is that the mean is equal to 6.75.  In the output, Stata tells you the null hypothesis it is testing (H0: mean = 6.75), which is a good way to double-check that you asked Stata to do what you intended it to do.

One important thing to keep in mind is that one of the points of asking Stata to do the hypothesis test is to calculate the test statistic for you - in this case, the t-statistic (which you see is listed as t=1.7381).  It is this t-statistic that Stata uses to give you the three probabilities at the bottom.

Now, the question - which one-sided hypothesis?  The three probabilities are the probabilities of three possible alternative hypotheses, according to the test that you set up in Stata.  Pick the one-sided hypothesis that corresponds to the alternative that you are interested in.  We are interested in the first one, Ha: mean<6.75, based on the alternative hypothesis that we stated earlier.  Pr(T<t) corresponds to area under the t-distribution that is less than the t-statistic you calculated (1.7381), or 0.9586.  This is the probability of observing the alternative listed or one more extreme, given that the null hypothesis is true.  So, the fact that the probability that we observed the alternative is really high - given that the null is true - isn't enough evidence for us to reject the fact that the null hypothesis is true.

If, though, we were interested in whether the mean was > 6.75, p=0.0414 - a relatively low probability that we observed this alternative or one more extreme, given that the null hypothesis is true.  Since this probability is so low (again, given that the null is true), we reject that the null hypothesis is true.

The other thing we discussed was that in practice, you usually end up using common sense (does the mean of 6.83 look bigger or smaller than 6.75?), but hopefully this explains the output a little better.

I hope that this helps more than confuses!