Ask a child if there is a shortage of ice cream in the world, and no doubt, the response will be an emphatic yes—there certainly is. And ask a tech CEO if there is a shortage of engineers, and you will get the exact same answer.

That’s the story I used to tell, based on my research on engineering graduation rates and outsourcing trends. In 2005, my team shattered the myths about India and China graduating 12 times the numbers of engineers as the U.S. (we found that the U.S. graduated more than India did in 2004, and the quality of Indian and Chinese graduates was not comparable to that of American schools). And our survey of 78 executives from companies that Lou Dobbs (remember him?) harangued for “Exporting America” revealed that they weren’t going offshore because of shortages of U.S. talent or deficiencies in the skills of Americans, but because it was cheaper and these companies needed to be closer to growth markets.

The argument that I made, and that the opponents of skilled immigration also make, is that if there was, indeed, a labor shortage, then engineering salaries would be rising and companies would be paying huge bonuses to attract and retain talent. This wasn’t the case a few years ago. But with Google giving 10% pay hikes to all of its employees and offering hundreds of thousands of dollars in retention bonuses, this appears to be happening today. In Silicon Valley, there seems to be a talent crunch: most startups, venture capitalists, and big company executives say it is very hard it is to hire the right talent; they claim that wages are rising.

But national unemployment rates are hovering around 10%, and tens-of-thousands of highly experienced computer programmers and technical specialists can’t find work. How can this be?

I believe I know the answer. But to be sure, I asked several experts and even my Twitter followers to share their opinion on my website. I received many insightful responses.

Sanjay Subhedar, a VC at Storm Ventures, says that in Silicon Valley, there is a shortage of Objective C developers, analog engineers who understand low power design, and good user-interface designers. There are also shortages of radio-frequency engineers in New York City and in Indiana.

Edward Alden, Senior Fellow at Council on Foreign Relations, explains that before the current downturn, computer programmers and software engineers were two occupations that had “something pretty close to full employment”. There was very strong wage growth during the tech boom (1999-2001), and then a leveling off—but not a decline—in wages from 2001-2007. Complaints of shortages continued post-recession, however, even when the overall unemployment rate of engineers was much higher. Alden postulates that employers are looking for very precise skill sets that are not readily available either because of inadequacies in U.S. education and training, or because of insufficient mobility in the labor force.

There is clearly a mismatch between need and skill availability. There are other problems also:

Many engineering graduates aren’t becoming engineers or joining startups, as UC-Berkeley engineering masters student Rahul Barwani noted. Most of Rahul’s classmates became management consultants or took other non-engineering jobs. That’s because they received higher salaries than what engineering firms or startups offer.

Startups don’t hire students fresh out of college because they can’t afford to train them. As Robert Shedd, CTO of Three Screen Games, explains, startups need people who can hit the ground running. And that is why college graduates in places like Tampa, Florida can’t get jobs, as IT consultant Roy Lawson observes.

American companies don’t invest in training their workforce any more like they used to. They expect workers to have all the right skills.

Nearly 60% of U.S. engineering post-graduate degrees and 40% of graduate degrees are awarded to foreign nationals. In the past, most of these students would remain in the U.S. after graduation and eventually become U.S. citizens. Now, because of flawed U.S. immigration policies, most buy one-way tickets home.

The world’s best and brightest aren’t beating a path to the U.S. any more. In previous years, H-1B visas for foreign nationals were in such high demand that they had to be awarded by lottery. This year, the annual quota of 65,000 hasn’t even been used yet. Instead, these workers are staying home and entrepreneurship is booming in countries like India and China.

So there are many issues here. But the national debates about competitiveness, immigration, and education, typically focus on the issue of supply and demand of engineers and scientists. They paint this issue in black or white when it is shades of gray.

On December 7, The Information Technology and Innovation Foundation is releasing a detailed report which analyzes Science, Technology, Engineering and Mathematics (STEM) education and worker shortages from a historical perspective. It finds that the standard indicators of salary growth and unemployment rates are not the best metrics for assessing shortages. The authors of the report say it is better to measure the length of time it takes for companies to hire STEM workers; analyze global job growth in a given sector; and compare the U.S. position in the global job market to other countries. They prescribe more skilled immigration and greater investments in the education and skills of American-born workers.

All of this is very important, because many countries in the world are moving faster than the U.S. They are learning to innovate and will provide stiff competition in the future. Just when the U.S. should be opening its doors wider to skilled foreign workers and be focusing on nurturing startups, it is turning protectionist and xenophobic. We need to give Silicon Valley every advantage it can have rather than handicapping it with uninformed and misguided policies.

Editor’s note: Guest writer Vivek Wadhwa is an entrepreneur turned academic. He is a Visiting Scholar at UC-Berkeley, Senior Research Associate at Harvard Law School and Director of Research at the Center for Entrepreneurship and Research Commercialization at Duke University. You can follow him on Twitter at @vwadhwa and find his research at www.wadhwa.com.