Image copyright Getty Images

The top-10 list of countries that won most Olympic medals barely changed between 2008 and 2012. The top four - US, China, Russia, UK - were identical. Just one country dropped out - Ukraine - which was replaced by Japan. But which countries did better or worse than we should have expected?

Standard medal league tables are unfair, whether they rank countries in terms of the number of gold medals they won, or their overall number of medals.

Some countries have larger populations - giving them a deeper pool from which to draw athletic talent - and some are richer, allowing them to invest more in sport.

Before the Games started, BBC Radio's More or Less programme decided to level the statistical playing field by working out how many medals nations could expect to win based on population and GDP alone.

"If you use those predictions as a kind of benchmark, then you can ask the question, who's done well and not so well relative to that prediction - who won more medals than they should have, and who won fewer," says Meghan Busse from the Kellogg School of Management at Northwestern University in the US, who helped with the sums.

Source: Meghan Busse of Northwestern University. Figures show gap between medals won and Busse's forecast based on population and GDP

Some of London 2012's over-achievers fall into one of three categories:

Former Eastern Bloc countries that still have good sporting infrastructure inherited from the Communist era, including Ukraine (14 extra medals), Hungary (13), Belarus (12), Azerbaijan (10), Georgia (7), Kazakhstan (7), Croatia (6), Lithuania (5), Mongolia (5), Serbia (4), Slovakia (4), Uzbekistan (4)

Small countries or low-income countries that have disproportionate depth in track and field sports, for which there are lots of medals available, including Jamaica (12), Kenya (11), Ethiopia (7) - on the basis of population and GDP alone, Meghan Busse would expect them to get none

There are also reasonably wealthy countries with small populations that over-achieve - perhaps because they have a very strong sporting tradition - like New Zealand (9)

But some of the biggest over-achievers were those at the top of the table. The US, China and UK, three of the top four medal winners in 2008 and 2012, actually got more medals than might have been expected on the basis of GDP and population.

More or Less: Behind the stats Listen to More or Less on BBC Radio 4 and the World Service, or download the free podcast Download the More or Less podcast More stories from More or Less

Busse estimates that Team GB should expect to get 32 medals when in fact they got 65 in total. She attributes this in part to the fact that host countries tend to invest more in sport in the years preceding the Olympics.

And even Australia, which has lamented its performance in 2012, winning 11 fewer medals than at the Beijing Olympics, is still punching above its weight (10 extra medals), according to Busse.

The countries that under-performed also fall into various categories, including:

Countries with big populations and reasonably large GDP, but low per capita incomes, such as India (28 fewer medals), Indonesia (-21), Mexico (-19), Brazil (-16), Venezuela (-14), Thailand (-12), Nigeria (-11), Philippines (-11), Pakistan (-10), Egypt (-9), Malaysia(-9), South Africa(-9) - both Nigeria and Pakistan have populations of over 150 million people but won no medals at all

Countries with relatively high per capita incomes but no strong tradition of playing Olympic sports, such as Saudi Arabia (-16), United Arab Emirates (-11), Israel (-8) and Hong Kong (-7)

Countries that put a bigger emphasis on the Winter Olympics than the Summer Olympics, such as Austria (-13), Switzerland (-12), Canada (-10) and Norway (-10)

Some of these over-achievers and under-achievers over-achieve and under-achieve on a regular basis. But even if you take into account past performance, as well as GDP and population - as Dan Johnson, an economics professor at Colorado College does - there were still some surprises.

Source: Meghan Busse of Northwestern University, based on population and GDP per head. Dan Johnson of Colorado College, based on population, GDP, past record and host-nation advantage

Iran (7 extra medals), Jamaica (5), New Zealand (6) and Japan (7) won many more medals than Johnson expected.

At the same time, he thinks Germany (16 fewer medals), Brazil (-10) , Romania (-6) , Bulgaria (5), Indonesia (5) and Greece (5) all fared surprisingly badly. It is the predictions that go wrong which make the Games so fascinating, Johnson says.

"The Olympics are all about athletic excellence", he says, "and it's most important to cheer when that excellence occurs in unexpected places."