A vigorous dispute has broken out over Scottish independence after a report claimed that North Sea oil would have made Scotland better off than the rest of the UK last year … The Scottish government's annual analysis of spending and revenue showed that Scotland had a smaller deficit proportionally than the rest of the UK in 2010-11, but only if its full geographical share of North Sea oil revenues, worth nearly £8.8bn last year, was included.

And recording Scottish data is complicated: not least because of the effects of devolution. Some data is recorded at a UK level, some at a Scotland level. Some of it is referred to as 'non-identifiable' - which means that the UK Treasury can't work out how much is spent specifically in Scotland.

Most of the money spent in Scotland comes from taxes raised centrally and although it does have the power to raise the basic rate of income tax by up to 3p - the government there has never used this. In 2010/11 the Scottish government calculated this would be worth £1bn.

The Scottish government is not able to borrow on the international markets, but can borrow short-term from the UK central government. Meanwhile, the Scottish government points out:

The UK Government is able to borrow to fund public sector expenditure across the UK, including the Scottish Government block grant

So what does the data say? The figures below are a mix of numbers from today's report and the Treasury.

Spending per person

The UK's Treasury public spending analysis does give us some regional breakdowns. The chart above shows spending per head for different parts of the UK. Under this analysis (not fully accepted by the Scottish government), Scotland receives more per person than any part of the UK, apart from Northern Ireland, which has expensive security issues.

The Scottish government says this is because the public sector in Scotland still includes water and sewage; more spending on education training; a greater reliance on agriculture and public services to go with it. Plus the fact that Scottish universities (which do not have £9,000 tuition fees) also have longer courses.

North Sea revenues - and their effect

At the moment, money raised from North Sea oil and gas revenues goes into the UK's central government pot. The Scottish government argues that geography is crucial to this and has calculated the effect of North Sea revenues based on the UK's continental shelf, so money from oil drilled in the region mapped here would be allocated to Scotland.

It has a much more dramatic effect than just dividing it up among the Scottish population based on its size.

Assuming a per capita share, Scotland's estimated share of total UK current revenue remains at the same level as the share assuming the exclusion of North Sea revenue, that is, 8.3 per cent in 2010-11. In contrast, under an illustrative geographical share, Scotland's estimated share of total UK current revenue increased to 9.6 per cent in the same year

If you look at the figures this way, it completely changes the Scottish economy. This shows the effect on Scotland's gross domestic product:

And this is the effect on public spending if you compare it with or without the 'geographic element".

Population

The latest population data shows Scotland has 5.2m people - up 2.5%, compared to a 3.5% increase in England. In 13 areas, the population has either gone down or stayed static, especially Inverclyde, where it has gone down by 2.8%.

Scotland has a slightly higher 'dependent population' than England - 38.2% are either over retirement age or children, compared to 37.4% of the UK. About half of Scotland's population change comes from migration, pretty similar to England.

The prime minister, David Cameron, and the Scottish first minister, Alex Salmond, sign a deal, dubbed the Edinburgh agreement, giving the Scottish government the power to hold a referendum on independence from the UK