The neutral theory of molecular evolution predicts that the ratio of polymorphisms to fixed differences should be fairly uniform across a region of DNA sequence. Significant heterogeneity in this ratio can indicate the effects of balancing selection, selective sweeps, mildly deleterious mutations, or background selection. Comparing an observed heterogeneity statistic with simulations of the heterogeneity resulting from random phylogenetic and sampling variation provides a test of the statistical significance of the observed pattern. When simulated data sets containing heterogeneity in the polymorphism-to-divergence ratio are examined, different statistics are most powerful for detecting different patterns of heterogeneity. The number of runs is most powerful for detecting patterns containing several peaks of polymorphism; the Kolmogorov-Smirnov statistic is most powerful for detecting patterns in which one end of the gene has high polymorphism and the other end has low polymorphism; and a newly developed statistic, the mean sliding G statistic, is most powerful for detecting patterns containing one or two peaks of polymorphism with reduced polymorphism on either side. Nine out of 27 genes from the Drosophila melanogaster subgroup exhibit heterogeneity that is significant under at least one of these three tests, with five of the nine remaining significant after a correction for multiple comparisons, suggesting that detectable evidence for the effects of some kind of selection is fairly common.