They say death and taxes are the only two sure things in life. But before we get to the former, just what is paying the latter actually doing for you?

According to political scientist Patrick Flavin, the science on how government spending affects things like public well-being and happiness is something of a mixed bag, with contradictory data suggesting there may be no discernible relationship between state spending and quality of life.

But on one measure at least, there looks to be a distinct and important link – at least when you analyse what exactly the government is spending your tax dollars on.

"To date, however, there has been only limited scholarly attention devoted to the composition of government spending," Flavin writes in a new paper, "how funding is allocated across spending categories."

Flavin, who hails from Baylor University in Waco, Texas, analysed 30 years of government spending data recorded by the US Census Bureau for 1976–2006, and ran it against reported levels of happiness for the same period.

To do that, he used self-reported happiness levels reflected in the the General Social Survey – a social study of a representative sample of American citizens, conducted by researchers from the University of Chicago.

What Flavin found was that Americans were happier in states where governments spent more of their relative budget on public goods – infrastructure like parks, libraries, and roads, as well as natural resources, and public services like policing.

"Public goods are things you can't exclude people from using – and one person using them doesn't stop another from doing so," says Flavin.

Of course, in a sense, this shouldn't be surprising at all. As Flavin points out, with more dollars being allocated to public goods, communities become "more liveable", and better access to better-quality amenities and infrastructure makes life easier and more pleasant.

"If roads are completed and kept up, so that people aren't stuck in traffic, they have more time to do things they enjoy doing," he says.

"Large parks are social spaces – and one clear finding of happiness studies is that people who are more socially connected tend to be happier."

The analysis suggests this link between public goods was constant across income, education, gender, and race/ethnicity lines, but other kinds of government spending didn't correlate the same way.

"This relationship does not hold for total government spending or for government spending on programs that are not (strictly speaking) public goods like education and welfare assistance to the poor," the paper notes.

Of course, the tricky and sometimes misleading thing about findings like this is they can seem to suggest a causative effect – but that's a red herring, because observational data like this only points out correlations.

In other words, we can speculate, but we don't know for sure why people living in the happier states were ultimately happier.

"It could be that happier citizens self-select by moving to states that spend comparatively more on public goods," Flavin explains.

"It also is possible that happier citizens support higher spending on public goods and elect state officials to deliver on that policy."

Those alternative explanations might seem unlikely, but we have to bear them in mind as possibilities, at least until more is understood about what's going on here.

To that end, Flavin says only more thorough science will help to spill what the secrets of happiness really are.

"Future empirical studies should examine how other categories of government spending correlate with measures of subjective well-being," he writes.

"Doing so will help to enhance our understanding about how government policy decisions can concretely impact the quality of life that citizens experience."

The findings are reported in Social Science Research.