The persistence phenotype is an epigenetic trait exhibited by a subpopulation of bacteria, characterized by slow growth coupled with an ability to survive antibiotic treatment. The phenotype is acquired via a spontaneous, reversible switch between normal and persister cells. These observations suggest that clonal bacterial populations may use persister cells, whose slow division rate under growth conditions leads to lower population fitness, as an "insurance policy" against antibiotic encounters. We present a model of Escherichia coli persistence, and using experimentally derived parameters for both wild type and a mutant strain (hipQ) with markedly different switching rates, we show how fitness loss due to slow persister growth pays off as a risk-reducing strategy. We demonstrate that wild-type persistence is suited for environments in which antibiotic stress is a rare event. The optimal rate of switching between normal and persister cells is found to depend strongly on the frequency of environmental changes and only weakly on the selective pressures of any given environment. In contrast to typical examples of adaptations to features of a single environment, persistence appears to constitute an adaptation that is tuned to the distribution of environmental change.