They can't really. This data is almost always self-reported. They can attempt to eliminate common confounds but the data is very noisy. People have a lot of bias and inaccuracies when reporting the primary data. Even questions like "how many cigarettes per day/week/month/year do you smoke?" is subject to enormous inaccuracies. And the more questions re confounds which are asked, the more the noise, and the lower the number of questionnaires returned. And no matter how many confounds are included in the questionnaires, there are likely a thousand more which also matter. It's a fairly major issue in health research, and why we so often see headlines with conflicting findings every few years. See research into the health of eggs, for example. One should be highly skeptical of correlative health evidence at this point (and this is what most of the clickbait studies are). Instead, try to focus on the causative research where they identify specific genes or chemical mechanisms which cause outcomes. This is much more difficult, of course, and sparse.