When Twitter went public, it was not just its own employees and stockholders who benefited from the initial public offering. Research tell us that when high-tech firms such as Twitter prosper, it results in more donations to local charities, and therefore more resources for health care providers, homeless services, museums and educational institutions in the San Francisco Bay Area.

You wouldn't know that, however, by following the latest protests featuring morally indignant and colorful allegations that the city's thriving tech sector is destroying the fabric of our society. The growing backlash against the tech boom has extended to allegations that our nonprofits are being squeezed out.

But the data tell us that, rather than hurting nonprofits, the tech boom is actually very good news for local nonprofits. Indeed, contributions to Bay Area nonprofits closely track the ups and downs of the Nasdaq market, which, in turn, closely mirrors the performance of tech firms in the region. In essence, a thriving tech sector means more and better services for the neediest of our residents.

In America today, cultural activities, education and health care are increasingly provided by charities. More than half of all hospitals, one-third of colleges and universities, and most cultural organizations depend on charitable donations. The Bay Area is no different. In turn, the not-for-profit world is increasingly dependent on the for-profit world. The research that I undertook in collaboration with fellow economists David Card and Kevin Hallock looked at 220 cities over a 20-year period and found much of the link between private and nonprofit sectors is local.

Over the past two decades, cities such as San Jose, Houston and especially San Francisco gained a significant number of corporate headquarters, while cities such as Chicago and Los Angeles lost them. Our analysis suggests that attracting or retaining the headquarters of a publicly traded company yields approximately $3 million to $10 million per year in contributions to local nonprofits. This directly translates in more services for vulnerable residents. It also means more paid jobs in the local nonprofit sector for those of us who are interested in making a difference in the community.

In our study, we also found that when local companies do well, they tend to give more. We estimate that for each $1,000 in market value of the firms whose headquarters are located in a city, about $1 goes to local nonprofits. Thus, the growth in stock prices of Google and Salesforce directly boosts the cash flowing to our charities. For example, Salesforce CEO Marc Benioff donated $100 million to build a new children's hospital in San Francisco. While it is true that some San Francisco nonprofits have been priced out of the Mid-Market area as a result of the new Twitter headquarters, the overall effect of the tech boom is overwhelmingly positive.

Our study showed that it is the workers, not the corporations they work for, who are driving the increase in giving. That is because adding a new headquarters to a city significantly increases the number of highly paid employees whose salaries are often tied to company performance. When the company does well, these employees tend to open their wallets to the local charities. By contrast, we found corporate (as opposed to individual) donations to be less important for local charities. With customers scattered across the globe, large corporations have limited incentive to favor local causes.

The growth of the high-tech sector is receiving growing criticism in San Francisco. The public debate is often framed in terms of the cliched inherent tension between: the haves versus the have-nots, tech workers versus the non-tech workers, corporations versus nonprofits.

This is a false juxtaposition.

There is no inherent contradiction between the interests of tech companies and our community. Our local economy is a tightly interconnected system, and what is good for one group typically tends to be good for another. This is a case where the rising tide does lift all boats - at least those boats bobbing in the same city.

Latest from the SFGATE homepage:

Click below for the top news from around the Bay Area and beyond. Sign up for our newsletters to be the first to learn about breaking news and more. Go to 'Sign In' and 'Manage Profile' at the top of the page.