Millions of Americans may be getting the wrong treatment to prevent a heart attack or stroke, a new study suggests.

Prescriptions for blood-thinning aspirin, cholesterol-lowering statins and blood pressure medications might be incorrect because a tool that estimates risk appears to be off by as much as 20 percent, Stanford University researchers reported.

That means almost 12 million Americans could have the wrong medication, according to the team led by Dr. Sanjay Basu, an assistant professor of medicine.

Get Breaking News Delivered to Your Inbox

It appears medications are overprescribed in many cases. But for black patients, outdated risk calculations may actually underestimate risk, the study authors said.

Risk estimate tools predict the likelihood of a future heart attack or stroke in the next 10 years. Doctors use these tools to help them decide what treatment a patient needs, if any at all.

But these tools are only helpful if they're accurate. There's been concern that some of the statistical methods used to develop a commonly used risk estimate tool in 2013 may be prone to miscalculating risk.

"What initially prompted us to do this study was a patient I had, an African-American gentleman who I thought was at pretty high risk for a heart attack or stroke. But when I put his information into the web calculator, it returned a bizarrely low-risk estimate," explained Basu.

When he looked into this issue, Basu said he saw other doctors commenting on the problem. And it seemed as if the risk estimates were both over- and underestimated.

The study authors cited the example of a 46-year-old white male smoker with normal blood pressure and abnormal cholesterol levels. The risk estimate tool said this man would have about an 11 percent risk of a heart attack or stroke resulting from plaque buildup in the arteries in the next 10 years.

When the researchers used the same information but changed his race to black, the tool dropped the risk to less than 7 percent. That would mean that being black lowered the man's risk of a heart attack or stroke by 40 percent. Yet past research suggests that being black raises -- not reduces -- the risk of heart attack and stroke.

Basu said the risk calculator assesses age, gender, race, whether or not people have diabetes, high blood pressure or abnormal cholesterol, and if they smoke tobacco.

Dr. Andrew DeFilippis, who wrote an editorial accompanying the study, said the 2013 risk tool uses information from research studies done decades ago.

DeFilippis is an associate professor of medicine at the University of Louisville.

Basu said using more recent data is one way to boost accuracy. When he and his colleagues updated the statistical modeling, they produced what they feel is a more accurate estimation.

However, Basu said this new risk estimation calculator needs to be validated by other researchers to ensure its accuracy. To that end, the researchers have made their statistical models and calculations available to anyone on the internet.

But if those initial calculations were off by 20 percent, potentially affecting 11.8 million people, where does that leave patients?

"If you're concerned, the most important thing to do is to talk to your doctor. Risk calculation is one of many factors that go into the decision about treatment. I'm more concerned about people who may have been given false assurances," Basu said.

DeFilippis concurred. "No one is saying this is a recipe you have to follow. For most clinicians it's a starting point. This is one tool we use to try to balance the risks of therapy with the potential benefit," he said.

"People who are at very low risk or very high risk are unlikely to get a different answer, but people who were borderline are the ones who may get a different answer," DeFilippis said.

Findings from the study were released online June 4 in the Annals of Internal Medicine.