Recently the Guardian’s Data Blog reported about the results from the third National Survey of Sexual Attitudes and Lifestyles in the UK. One of the questions asked in the survey was if the participants had sex in the last four weeks. The results – a summary is available in this info graphic – show that the British have their most sexual active period when they are in their 20s – 40s.
The article ended with the Guardian asking its readers to answer the same question over the course of a week. Last Friday they published some high level numbers in a follow-up post. Of course there are many things you may criticise about their survey, e.g. it isn’t randomised. However, the data provide a nice little example to get familiar with the
prop.test function in R, to test if the proportions (probabilities of success) in several groups are the same, or that they equal certain given values.
Here are the data and a first plot:
Although the numbers of responses vary a lot between age groups, the proportion of those who answered with ‘Yes’ look more similar:
prop.test allows me to test, if the proportions of those who said ‘Yes’ are the same between different age groups.
Running the test across all age groups shows that if the hypothesis were true, then it would be very unlikely to observe the data by chance; the p-value is less than 2.2e-16. Unlike when I compare the age groups of 25-34 and 35-44 years old. Here the p-value is 11.4% and hence I might accept that the behaviours of the two groups are similar (61% vs. 59%). Adding the next age group on the other hand suggests that the three groups are less likely to have the same proportion (p-value is 0.2%). Still, when I compare the groups of 35-44 and 45-54 years old, then I might accept again that they have a similar sexual activity (p-value 8%).
What do I make of this? Well, most will not notice a change of their sexual activity on a day to day basis. Only when they look back over the decades they will notice a significant change. No surprise there, ageing is a slow process.
R version 3.0.2 (2013-09-25) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale:  en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages:  stats graphics grDevices utils datasets methods base other attached packages:  latticeExtra_0.6-26 lattice_0.20-24 RColorBrewer_1.0-5 loaded via a namespace (and not attached):  grid_3.0.2 tools_3.0.2