Uncertainty favors an induced immune response to infection