  The precise form of the foregrounds for sky-averaged measurements of the
21-cm line during and before the epoch of reionization is unknown. We suggest
that the level of complexity in the foreground models used to fit global 21-cm
data should be driven by the data, under a Bayesian model selection
methodology. A first test of this approach is carried out by applying nested
sampling to simplified models of global 21-cm data to compute the Bayesian
evidence for the models. If the foregrounds are assumed to be polynomials of
order n in log-log space, we can infer the necessity to use n=4 rather than n=3
with <2h of integration with limited frequency coverage, for reasonable values
of the n=4 coefficient.
  Using a higher-order polynomial does not necessarily prevent a significant
detection of the 21-cm signal. Even for n=8, we can obtain very strong evidence
distinguishing a reasonable model for the signal from a null model with 128h of
integration. More subtle features of the signal may, however, be lost if the
foregrounds are this complex. This is demonstrated using a simpler model for
the signal that only includes absorption.
  The results highlight some pitfalls in trying to quantify the significance of
a detection from errors on the parameters of the signal alone.
