Giant impacts by comets and asteroids have probably had an important influence on terrestrial biological evolution. We know of around 180 high-velocity impact craters on the Earth with ages up to 2400 Myr and diameters up to 300 km. Some studies have identified a periodicity in their age distribution, with periods ranging from 13 to 50 Myr. It has further been claimed that such periods may be causally linked to a periodic motion of the Solar system through the Galactic plane. However, many of these studies suffer from methodological problems, for example misinterpretation of p-values, overestimation of significance in the periodogram or a failure to consider plausible alternative models. Here I develop a Bayesian method for this problem in which impacts are treated as a stochastic phenomenon. Models for the time variation of the impact probability are defined and the evidence for them in the geological record is compared using Bayes factors. This probabilistic approach obviates the need for ad hoc statistics, and also makes explicit use of the age uncertainties. I find strong evidence for a monotonic decrease in the recorded impact rate going back in time over the past 250 Myr for craters larger than 5 km. The same is found for the past 150 Myr when craters with upper age limits are included. This is consistent with a crater preservation/discovery bias modulating an otherwise constant impact rate. The set of craters larger than 35 km (so less affected by erosion and infilling) and younger than 400 Myr is best explained by a constant impact probability model. A periodic variation in the cratering rate is strongly disfavoured in all data sets. There is also no evidence for a periodicity superimposed on a constant rate or trend, although this more complex signal would be harder to distinguish.