Appendix: Quick correlational analyses of sex frequency and masturbation frequency

Created 25 Feb 2013 • Last modified 20 Sep 2016

Here I check correlations between sex frequencies and masturbation frequencies in the National Health and Social Life Survey (Laumann, Gagnon, Michael, & Michaels, 1994).

All the below code is in R.

First, we load the data.

d = read.spss("nhsls.sav", = T)
names(d) = tolower(names(d))
attr(d, "variable.labels") = `names<-`(
    tolower(attr(d, "variable.labels")),
    tolower(names(attr(d, "variable.labels"))))

These are the variables of interest:

attr(d, "variable.labels")[c("gender", "mast12a", "sexfreq")]
gender gender of r
mast12a how often does r masturbate
sexfreq how often r had sex in last year

Let's filter out all subjects with missing values on any of the variables.

d2 = droplevels(subset(d,
    !(gender %in% c("Refusal", "DK", "Missing")) &
    !(mast12a %in% c("Refusal", "DK", "Missing")) &
    !(sexfreq %in% c("Refusal", "DK", "Missing"))))

We still have a big sample:

c(d = nrow(d), d2 = nrow(d2))
d 3432
d2 3181

Here's how mast12a and sexfreq are coded.

1 > once a day
2 Every day
3 Sev. times a wk
4 Once a week
5 2-3 times a mon
6 Once a month
7 Every other mon
8 3-5 times a yr
9 1-2 times a yr
10 0 times a year
1 Not at all
2 Once or twice
3 About once month
4 2or3 times month
5 About once week
6 2or3 times week
7 4+ times a week

It appears that Laumann et al., annoyingly, used different and largely incompatible response scales. We will then do Kendall correlations. We can at least reverse mast12a so that higher scores mean greater frequencies. We also need to cast sexfreq to an ordered datatype.

x = with(d2, data.frame(
    mastf = 11 - as.integer(mast12a),
    sexf = as.integer(sexfreq)))

Now, for each gender, we get the sample Kendall correlation and a 95% bootstrap CI.

round(digits = 3, sapply(c("Male", "Female"), function(g)
    with(subset(x, gender == g), c(
        observed =, sexf),
        quantile(p = c(.025, .975), replicate(3e4,
           {i =, rep = T)
  [i], sexf[i])}))))))
  Male Female
observed -0.099 -0.008
2.5% -0.142 -0.046
97.5% -0.055 0.030

For both genders, the magnitude of the correlation is small. Among women, the sample correlation is so close to 0 that the CI spans 0 despite the huge sample size. (Perhaps the sociologists and personality psychologists in the audience don't think sample sizes in the thousands are so impressive, but for an experimental psychologist like me, they're awe-inspiring.) Among men, we can conclude that the population correlation is negative, but not large, no bigger than −.15. To get a sense of just how small a correlation of −.15 is, see this figure, and bear in mind that prediction with a Kendall correlation should be even less precise than prediction with a Pearson correlation of the same size.

Such weak findings make it hard to believe that masturbation is largely a means of compensating for low sex frequencies.


Laumann, E. O., Gagnon, J., Michael, R. T., & Michaels, S. (1994). The social organization of sexuality: Sexual practices in the United States. Chicago, IL: University of Chicago Press.