> MA: Lab Materials--week 8

MA Soc: Lab Materials Week 9

Week 10 Lab

Tables and formula

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".

ID Before After
 1    31    29
 2     8     7
 3    12    12
 4    14     9
 5     6     0
 6     8     3
 7    18    17
 8     8     2
 9    35    35
10    34    31
11    34    35
12    28    31
13    12    12
14    36    35
15    23    22
16     7     6

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:

  1. The data are available here in a spreadsheet
  2. Calculate the before/after difference in the fourth column
  3. Calculate the mean difference (=average(...))
  4. In the fifth column calculate the deviation (X minus X-bar)
  5. In the next column calculate the squared deviations
  6. Sum the squared deviations
  7. From these calculate the standard deviation, using the formula sheet
  8. From that, calculate the Standard Error
  9. Use the standard error and the t-table to construct a confidence interval and use that to test your null hypothesis
  10. 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".

  1. Do a hypothesis test using the confidence interval
  2. Find the t-value and do a hypothesis test by comparing it to the critical value
  3. 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.

Brendan Halpin
Department of Sociology, University of Limerick
F1-002, x 3147; brendan.halpin@ul.ie