Tables and formula are available here. These will be available during
the exam. For today's purposes they include the table of Student's
t Distribution.

A worked example of a hypothesis test

Suppose you are interested in the effect on wellbeing of going on
holiday. To investigate this, you apply the General Health
Questionnaire (a standardised set of questions designed to measure
subjective wellbeing) to a sample of people some time before and
sometime after going on a two-week holiday. You summarise the GHQ
into two scores for each individual, in the range 0-36 (higher
means worse), "before" and "after".

If you want to test whether there is a difference, then your
"null hypothesis" is that the average difference is zero. Conduct a
full test. The steps are as follows:

Calculate the before/after difference in the fourth column

Calculate the mean difference (=average(...))

In the fifth column calculate the deviation (X minus X-bar)

In the next column calculate the squared deviations

Sum the squared deviations

From these calculate the standard deviation, using the
formula sheet

From that, calculate the Standard Error

Use the standard error and the t-table to construct a
confidence interval and use that to test your null hypothesis

What is the result? Do you reject or fail to reject the
null hypothesis, and what does this mean for the initial
research hypothesis?

Hypothesis testing and significance in Stata

We can conduct the same hypothesis test in Stata with less
work. The data set is available in this do-file (do
http://teaching.sociology.ul.ie/so5041/week11.do). First,
generate the difference, and use ttest diff == 0
to do a "one-sample t-test".

Do a hypothesis test using the confidence interval

Find the t-value and do a hypothesis test by comparing it to the
critical value

Find the relevant p-value and do a hypothesis
test by comparing it to 1-C (where C is your confidence level, i.e.
95% confidence requires p<=0.05).

Repeat the test using Stata's "paired sample t-test" syntax:
ttest after==before. Compare this carefully with the
one-sample syntax.