A simple Bayesian method of inferring extinction