Effect of social group dynamics on contagion.