# PC Labs for SO5041: Week 9

## Table of Contents

## Week 9 Lab: Hypothesis tests

### 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:

- The data are available here in a spreadsheet
- Calculate the before/after difference in the fourth column
- Calculate the mean difference (
`=sum(...)/16`

) - 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 (see t-dist app) 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?

### In Stata

Import the data into Stata:

import delimited using http://teaching.sociology.ul.ie/so5041/labs/hypotest.csv

Then use the `ttest`

command (as shown in the lecture) to do the same test. Compare your results with Stata's.