  The use of heuristics to assess the convergence and compress the output of
Markov chain Monte Carlo can be sub-optimal in terms of the empirical
approximations that are produced. Typically a number of the initial states are
attributed to "burn in" and removed, whilst the remainder of the chain is
"thinned" if compression is also required. In this paper we consider the
problem of retrospectively selecting a subset of states, of fixed cardinality,
from the sample path such that the approximation provided by their empirical
distribution is close to optimal. A novel method is proposed, based on greedy
minimisation of a kernel Stein discrepancy, that is suitable for problems where
heavy compression is required. Theoretical results guarantee consistency of the
method and its effectiveness is demonstrated in the challenging context of
parameter inference for ordinary differential equations. Software is available
in the Stein Thinning package in Python, R and MATLAB.
