The problem with a lot modern science is that you're dealing with a virtually infinite numbers of variables both environmentally, behaviourally and genetically.
Short of having a thousand identical twins locked up in a room from birth you're swimming against a very strong tide. Long gone are the days when science was as simple as castrating a rooster and grafting his balls back: https://en.wikipedia.org/wiki/Arnold_Adolph_Berthold
> Wouldn't taking these kind of factors into account be quite basic part of the analysis?
They acknowledge that they are just looking at the number of prescriptions and that the research doesn't show that the drugs themselves were reducing people's risk.
It could equally be the amount of sex that is reducing the risk.
Of course, they cannot take everything into account.