Stanford professor James T. (Jay) Hamilton is a realist. Expensive and ambitious investigative reporting, Hamilton writes, "is underprovided in the market." Financial pressures have taken thousands of local watchdogs out of the game.

Yet Hamilton argues in his bracing new book, "Democracy's Detectives," that hard-nosed application of economic principles supports a guarded optimism about the future of investigative journalism.

He demonstrates that costly six-month and yearlong projects often yield hundredfold benefits to society in the reforms they provoke.

What is more, the best of this kind of work helps news organizations differentiate themselves from the pack of quotidian commodity news in the eyes of consumers. So it's potentially a business asset.

And advances in data analysis and algorithms, "may make it easier for journalists to discover and tell the stories that hold institutions accountable." Perhaps also to target the broadest, most interested audience in fixing the abuses identified.

Hamilton has been an admired professional friend of mine for more than a decade, and we have occasionally collaborated informally. So I know he began in the late 2000s pondering questions such as whether investigative reporting that saves lives is adequately valued, given that those spared may never know the danger averted.

He takes a shot at that one and many more with some surprising applications of economic principles, ingenious attempts at measuring what seems unmeasurable and well-chosen historical references.

The book opens with an episode, perhaps known to many media history buffs but not to me — Frank Leslie's 1858 expose of the swill milk trade in New York City. In short, cows were being fed swill waste from distilleries and became sickly and germ-ridden. Their milk, blended with other disgusting ingredients, was sold in poor parts of the city and often labeled "Pure Country Milk" from rural Westchester County. The situation was known in a general way but only lightly covered.

The crusade put Frank Leslie's Illustrated Weekly on the media map of the time. He gained 50,000 additional subscribers in a single year, pulling ahead of a competitor. And, with The New York Times in hot pursuit of the story as well, the reporting ultimately cleaned up the practice, saving many lives (though not, alas, eliminating scandals of adulterated food for good).

Leslie called his corps of writers and illustrators "detectives," giving the book its title. And that provides Hamilton's working definition of investigative reporting — finding and documenting what the powerful want to keep hidden and telling those stories with impact. The through-line from swill milk to "Spotlight" is clear.

Using the economic concept of agency, Hamilton argues that "the breakdown of delegated decision-making in institutions" is nearly inevitable. The top levels of a firm or government may be committed to lofty goals, but down the chain, "agents" protect their positions with hidden actions and hidden information.

Try that on for size as a short summary of the Flint water crisis. Or close to home at Poynter's Tampa Bay Times, the Pulitzer-winning "Failure Factories" series found a school board for years blissfully unaware of how bad the dysfunction was ground level at five high-poverty, predominantly Black schools.

That view of investigative reporting cuts several ways. What's hidden is hard to unearth, with denials and cover-ups to be expected. That's why big investigations of systemic issues take months and years — not weeks — and can cost tens or hundreds of thousand dollars.

On the upside, there will always be abundant such "breakdowns" to investigate. But that leads Hamilton to wonder, as many others have, how much corruption goes undetected as the ranks of local newspaper journalists have fallen by 40 percent in just a decade.

I won't try to summarize all the avenues explored in the 316-page book. But the novelty of Hamilton's methodology is worth a look. For instance, he produces a detailed analysis of IRE and Pulitzer winners to detect changing patterns in which organizations do the most ambitious projects and how.

Then there is a 70-page chapter on the career of a single investigative reporter — Pat Stith of the News and Observer of Raleigh, a sort of micro-economic window into the craft. At first I thought Stith must have kept meticulous personal records while turning out decades of deep reports on wrongdoing in North Carolina.

It's little more complicated, Hamilton explains under the subhed "Coding a Career."

After talking with Stith in person, I realized that the best investigator of the impact of his work would be...him. He was most likely to remember that the stories he wrote, the follow-on investigations and the ultimate impact of the revelations. His agreement to be hired to investigate the impact of these investigations made this section of the chapter possible.

What follows is a cataloguing of Stith's works from stories the reporter calls modest "dingers," embarrassing officials without necessarily producing change, to a 1995 investigation of the mountains of excrement from commercial hog farming — a series that won a Pulitzer. Stith's was a 42-year-run unlikely to be repeated, Hamilton writes, even at a paper like the N&O that still blocks out resources for investigations.

The general reader may get lost or glaze over at some discussion of correlation chi squares or the 40 accompanying tables. But Hamilton also writes well and precisely, as in this opening to a chapter on how investigative work is supported:

It has always been cheaper to repeat the news than to make it. The nature of facts as public goods, so that my consumption of a fact does not prevent you from consuming that very same fact and so that you can consume the fact even if you have not paid for it, often tilts news outlets to reproduce the essential elements of stories generated by others. Over time this has taken many forms in U.S. news outlets....

Of course in the present the trend leads to no end of aggregation and curation, much of it at wildly profitable sites that do little reporting — let alone any heavy-duty investigating.

"Democracy's Detectives" finds hope in the rise of local nonprofits like The Texas Tribune, The Voice of San Diego and MinnPost. And Hamilton devotes his last chapter not to general musing on the future, but to a detailed examination of the promise of "advanced computational journalism," streamlining and strengthening more traditional shoe-leather investigations.

Hamilton concedes, though, that his conclusion amounts to "a warning and a wish." On the one hand, the changes in media markets "put local investigations particularly at risk." On the other, Hamilton, clarifies "the great benefits to society" of original content on public issues — even when that means a smaller return for investors.

And a growing group of nonprofit donors and benevolent owners like Jeff Bezos and Philadelphia's Gerry Lenfest seem to be getting the point.