The result is what Dr. Kramer calls whipsaw literature. “One week drinking coffee is good for you, and the next week it is lethal,” he says.

The situation is so bad that what gets published tends to be what the scientists believe ahead of time, says Dr. John Ioannidis, a professor of medicine and of health research and policy at Stanford University’s medical school. “There are so many nutrients and so many diets,” he said. “So many outcomes — heart disease, cancer, stroke. What kind of data do you collect? A follow-up at two months, six months, two years, 10 years? You end up having millions of choices.”

And the scientists get to pick the one they want. “I can get you any result you want in any observational data set,” he said.

There have been rigorous lifestyle studies, but they are few and far between. A large diet study in Spain found that a Mediterranean diet, with fruits, vegetables, fish and olive oil or nuts, decreased the risk of heart attacks and strokes. Two large federal studies looked at a high-fiber diet but failed to find evidence it protects against colon cancer.

Then there are the seemingly contradictory but well-done studies. One large federal study found that — contrary to all assumptions — diet and weight loss did not prevent heart attacks and strokes in people with Type 2 diabetes. Another large federal study found that people at risk for Type 2 diabetes could stave it off by losing a modest amount of weight and exercising.

A few years ago, two researchers decided to ask just how crazy the cancer and diet literature was. They began with a cookbook, “The Boston Cooking-School Cookbook,” and randomly selected recipes, listing the ingredients, until they had 50 distinct ingredients. Then they did a literature search asking if those ingredients were associated with cancer.

Four out of five were linked to cancer, the researchers reported, either increasing or decreasing the risk. Often the same ingredient that increased risk in one study decreased it in another. Those ingredients not associated with cancer risk tended to be odd, like terrapin, and had not been studied by nutrition researchers.