  In a search for short timescale astrophysical transients in time-domain data,
radio-frequency interference (RFI) causes both large quantities of false
positive candidates and a significant reduction in sensitivity if not correctly
mitigated. Here we propose an algorithm that infers a time-variable frequency
channel mask directly from short-duration ($\sim$1 s) data blocks: the method
consists of computing a spectral statistic that correlates well with the
presence of RFI, and then finding high outliers among the resulting values. For
the latter task, we propose an outlier detection algorithm called
Inter-Quartile Range Mitigation (IQRM), that is both non-parametric and robust
to the presence of a trend in sequential data. The method requires no training
and can in principle adapt to any telescope and RFI environment; its efficiency
is shown on data from both the MeerKAT and Lovell 76-m radio telescopes. IQRM
is fast enough to be used in a streaming search and has been integrated into
the MeerTRAP real-time transient search pipeline. Open-source Python and C++
implementations are also provided.
