The probability of a history, P(Z i |h), is a function of the set of switches in selective mode required to explain the history parsimoniously. For each history to be explained parsimoniously, switches must be allowed to occur early (near the ancestor) or late (near the descendant) on each internal branch, as well as (early) on each external branch ( Figure 4A ; see Text S1 for a justification of the model). Thus, there are twelve possible switch points, with three of them adjoining each of the four internal nodes of the tree. It is convenient to denote these points P nb : n[N ,b[B n f g where N is the set of internal nodes and B n represents the branches adjoining node n. Let V nb M {0,1} and W nb M {0,1} indicate the selective states before and after point P nb , respectively. For a given history Z i , these variables are uniquely determined by parsimony according to a simple algorithm (see Text S1). The four possible values of (V nb , W nb ) correspond to four possible scenarios at P nbgain of selection (0,1), loss of selection (1,0), absence of gain (0,0), or absence of loss (1,1). The probabilities of these scenarios (i.e., the conditional probability of each W nb given V nb ) are defined by a parameter for gains (h nbG ) and a parameter for losses (h nbL ) at each point. In addition, the prior probability of selection at the root of the tree is given by a parameter h 0 . (For this analysis, the most recent common ancestor of the primates and rodents is treated as the root of the tree; see Text S1.) The set of parameters can thus be described as h~h nbe :