Polling – or perhaps more importantly, the abuse of polling data – has a checkered history in Venezuela. I will never forget the day of the presidential recall referendum in 2004. I was sitting in the BBC studio in Washington, between a TV and radio interview, and the fax machine spat out a release from what was then one of the most influential Democratic polling and consulting firms in the United States: Penn, Schoen, Berland and Associates.

"Exit Poll Results Show Major Defeat for Chavez" was the headline. The agency claimed to have interviewed an enormous sample (more than 20,000 voters at 267 voting centers), and found that Chávez had been voted out of office by a margin of 59% to 41%.

I looked up at the producer who gave me the fax with more than a bit of perplexity. With good reason: the actual result of the referendum was the opposite: 58% to 41% against the recall. The Organization of American States and the Carter Center observed the election and made it clear that there was no doubt that the results were clean. Given the actual vote, the probability of the variation in PSB's result was less than 1 chance in 10 to the 490th power, if you can imagine something that unlikely.

The producer put the press release aside. "I'm not doing anything with this unless there's another source," she said.

Which brings us to the current presidential election on Sunday. The most recent polls show a wide range of possibilities, from a 4% lead for President Hugo Chávez's challenger, Henrique Capriles, to a 27.7% lead for Chávez himself. The average is a lead of 11.7 points for Chávez over Capriles.

My CEPR colleague David Rosnick did a statistical analysis of the most recent polling data to adjust for the biases of the various polling firms, using data from 2004-2012. The adjusted lead increases to 13.7 percentage points, with Capriles having an estimated 5.7% chance of winning the election.

Nevertheless, much of the US media is making it look like a close race, in spite of the polling data. It's not as bad as 2004, when most of the major foreign media were pretending – ridiculously, as it turned out – that the recall referendum was "too close to call". There is progress in history.

Also, this time, some reporters and analysts who are trying to report more accurately for investors – the Venezuelan bond market has shown some "irrational exuberance" lately on the hope of a Capriles victory – are saying that Chávez will likely win.

More gravely, though, the Venezuelan opposition in past elections has always had a "plan B", which is to claim fraud if they lose and to bring people into the streets. We saw this in 2004: there was even some academic research that – with help of conspiracy theories that made the 9/11 fantasies of Loose Change look reasonable by comparison – claimed to find statistical evidence that the election was stolen. The Carter Center had to set up an independent panel of academic statisticians to look at this statistical "evidence", and they found it to be nonexistent (pdf).

But these allegations had a significant impact in Venezuela – where the opposition boycotted the 2005 congressional elections on the grounds that the 2004 referendum had been "rigged". Much of the Latin American press also ran with the conspiracy theories.

What about Sunday's election? Chávez made his usual statement that he would accept the results, no matter what; Capriles has been less committal. One of the best things the electoral authorities have going for them is that the Obama administration – like the Bush administration in 2004 – doesn't want any trouble that could raise the price of gasoline before the US presidential election. And Capriles and most of his allies would be unlikely to mount an organized effort to dispute the results with Washington recognizing them.

Putting their elections right before ours in the US was one of the smartest things that the Venezuelan government could have done to ensure the integrity of their electoral process. But there are elements of the opposition that are already saying that Capriles must win and that there will be violence in the streets if the election is "stolen". So "plan B" actions are still possible.

The polling story from 2004 has a happy ending. In 2006, PSB produced some pre-election polls that nobody could believe (Chávez ended up winning with 62.8% of the vote). So Mark Penn replaced pollster Doug Schoen. Penn went on to be Hillary Clinton's chief strategist in her 2008 presidential bid, offering insights on how to go after the "unelectable" Obama for his "lack of American roots". Penn was forced to resign as chief strategist when it was discovered that he was helping the Colombian government lobby for a "free trade" agreement with the US.

Doug Schoen, meanwhile, has just published a new book about the "crisis in American politics". It's called Hopelessly Divided, and it has glowing endorsements from such luminaries as Michael Bloomberg and Bob Shrum. I hope they checked the polling data the author is using.

Is this a great country or what? No matter how badly you mess up, there's always another chance. Well, at least for some people.