We have not considered the case in which the trait of interest is a precursor of the trait under selection (Fig. 2). Selection bias also occurs in this case10,17,20, but cannot immediately be corrected by our approach because it would require knowledge of the effects of all confounders (Supplementary Note 2). Methods exist to adjust for selection in this situation18,19,21,22, although they do not allow for unmeasured confounders. It may be possible to combine our approach with these methods to more fully account for selection bias in this situation.