Imagine a general store, generations ago. The storekeeper might, through experience, get a feel for how customers will tolerate increases to the price of ice cream on a hot July day, or the minimal amount to discount hot dogs to trigger increased sales of buns.

Unfortunately for shopkeepers expanding their businesses, intuition doesn't scale. So we turn to data analytics to reveal relevant patterns. Enormous supermarkets now process rivers of customers and adjust prices by the hour. Data analytics can reveal the extent to which factors from vegetable placement to the number of checkout registers influence customers.

The public sector deserves similar gains. Recent advancements in analytics, natural language processing, machine learning, and speech and image recognition have made it possible for government to predict and anticipate problems rather than react to them. As institutions become too large for any one participant to notice, data analytics exposes relationships that disparate institutional entities would likely overlook. Who in a British hospital besieged with traffic-accident victims would have guessed, for example, that changing the wording on speeding tickets could reduce reoffending by 20 percent?

Governments are complex institutions, touching as they do the parts of society that are not simple enough to self-correct via market forces. This complexity creates an opportunity to identify myriad relationships, which may influence not just quality of service, but matters of life and death.

The Centers for Disease Control and Prevention, for example, uses data analytics to track the variables in public health problems. It has found predictive analytics especially effective for combating highly contagious diseases such as measles. Data on the disease's spread informed the aggressive response that shut down a 654-case outbreak in New York City.

In sub-Saharan Africa, Atlas AI and the Alliance for a Green Revolution in Africa have used data analytics to introduce smallholder farms — which account for 90 percent of the region's agriculture — to more sophisticated distribution networks. Farmers also receive information previously available only to agricultural behemoths: predictive models from crop data and satellite imagery to help maximize yields.

Counterterrorism relies heavily on data analytics to identify connections between members of terror groups and signs of money laundering. Local police use similar techniques to identify factors likely to correlate with increased crime rates and to disrupt the chain of incentives that lead to lawbreaking — for example, by parking a police car in high-risk neighborhoods when robberies are predicted. Durham, N.C., used predictive policing to help reduce violent crime by 39 percent between 2007 and 2014, compared to a 22 percent decrease nationwide. That represents not just a success for public safety but also cost savings that would have been spent in the prison system.

Better resource allocation represents a major potential advantage of predictive analytics. At the municipal level, the technology is now used widely to predict code violations. Chicago algorithmically targets restaurant inspections, which has increased the number of dangerous conditions found per visit. Atlanta's fire department uses data analytics to more efficiently conduct building inspections. Efficient uses of funds saves taxpayer money. Effective prophylactic uses, like preventing fires, save even more. Having the ability to recognize the likely effects of design choices, from behavioral nudges to ecological inputs to supply chain management, allows governments to make decisions that improve the chance of the best outcomes.

However, as with any governmental initiative, new predictive powers carry ethical responsibilities. In view of the risks and uncertainty associated with artificial intelligence and predictive algorithms, many governments are developing and implementing regulatory and ethical frameworks for the implementation of these new technologies. The U.K. government has developed a data ethics framework to clarify how public sector entities should treat data. Canada has an Algorithmic Impact Assessment questionnaire to assess risks in these systems.

Governments have used predictive technology to stem human trafficking, reduce pollution, create more efficient traffic flows, prepare for natural disasters and detect tax fraud. But they lag behind tech companies in terms of how quickly they assess and update services to better serve citizens and meet their disparate responsibilities. Leaders who are serious about understanding the communities they serve will find new ways to use predictive analytics for insights to tailor government processes for superior results.