Any given vaccine can fail to produce immunity in an individual, and some vaccines, like the influenza vaccine, are less effective than others. But when enough people are vaccinated with even a relatively ineffective vaccine, viruses have trouble moving from host to host and cease to spread, sparing both the unvaccinated and those in whom vaccination has not produced immunity. This is why the chances of contracting measles can be higher for a vaccinated person living in a largely unvaccinated community than they are for an unvaccinated person living in a largely vaccinated community.

