The term P (X i | Z i ) in equation 1 is simply the likelihood at gene i of a branch-site codon model that assumes selection history Z i . A full Bayesian approach would integrate over the parameters of these codon models, but this would be computationally prohibitive. Instead, we make the Empirical Bayes simplification of conditioning the analysis on maximum likelihood estimates of the parameters of the codon models. The maximized log likelihoods L ij for all genes i and histories j are precomputed using existing software (in parallel, on a large computer cluster) and stored in an N6M matrix, which is then used in the inference of selection histories.