Studies have found that roughly 40 percent of students planning engineering and science majors end up switching to other subjects or failing to get any degree.Based on my highly scientific sample of about a dozen second-generation Indian Americans who started out in science/engineering but switched careers, the article is wrong. It is not because the kids can't grok the math or find the subjects boring. On the contrary, it is solely because engineering and science in the United States are low-status occupations. Doctors are high-status, and so students stick with it. The reason the kids didn't pursue STEM careers is that they have better options -- bankers and lawyers make more money.
The reason why graduate students in engineering are mostly immigrants is the same reason that most fruit pickers in Georgia are Mexicans. Americans don't want to do this stuff. Science, engineering and fruit-picking is what people fresh-off-the-boat do.