The problem of testing for nonhomogeneous white noise (i.e., independe
ntly but possibly nonidentically distributed observations, with a comm
on, specified or unspecified, median) against alternatives of serial d
ependence is considered. This problem includes as a particular case th
e important problem of testing for heteroscedastic white noise. When t
he value of the common median is specified, invariance arguments sugge
st basing this test on a generalized version of classical rims: the ge
neralised runs statistics. These statistics yield a run-based correlog
ram concept with exact (under the hypothesis of nonhomogeneous white n
oise) p-values. A run-based portmanteau test is also provided. The loc
al powers and asymptotic relative efficiencies (AREs) of run-based cor
relograms and the corresponding run-based tests with respect to their
traditional parametric counterparts (based on classical correlograms)
are investigated and explicitly computed. In practice, however, the va
lue of the exact median of the observations is seldom specified. For s
uch situations, we propose two different solutions. The first solution
is based on the classical idea of replacing the unknown median by its
empirical counterpart, yielding aligned runs statistics. The asymptot
ic equivalence between exact and aligned runs statistics is establishe
d under extremely mild assumptions. These assumptions do not require t
hat the empirical median consistently estimates the exact one, so that
the continuity properties usually invoked in this context are totally
helpless. The proofs we are giving are of a combinatorial nature, and
related to the so-called Banach match box problem. The second solutio
n is a finite-sample, nonasymptotic one, yielding (for fixed n) strict
ly conservative resting procedures, irrespectively of the underlying d
ensities. Instead of the empirical median, a nonparametric confidence
interval for the unknown median is considered. Run-based correlograms
can be expected to play the same role in the statistical analysis of t
ime series with nonhomogeneous innovation process as classical correlo
grams in the traditional context of second-order stationary ARMA serie
s.