p ($_{q}$ | u , y ) . Using the definitions in Equations 4, 5, and 6, we get To sample directly from p ($_{q}$ , u | y ) , one needs only to sample from p ( u | y ) and then sample repeat- edly from g ($_{q}$) until F ($_{q}$ | y ) > u . The samples of q form the marginal distribution p ($_{q}$ | y ) , and since sampling from p ($_{q}$ | y ) is equivalent to sampling from $_{p}$($_{q}$ | y ) , they form an empirical estimate of the target posterior density. But how does one simulate from p ( u | y ) ? In Equation 8, we see that p ( u | y ) is proportional to the function q ( u ) . Walker et al. (2011) sample from a similar kind of density by first taking M proposal draws from the prior to construct an empirical approximation to q ( u ) , and then approximating that continuous density using Bernstein polynomials. However, in high-dimensional models, this approximation tends to be a poor one at the endpoints, even with an extremely large number of Bernstein polynomial components. Our approach is similar in that we effectively trace out an empirical approximation to q ( u ) by repeatedly sampling from g ($_{q}$) , and computing F ($_{q}$ | y ) for each of those proposal draws. To avoid the endpoint problem in the Walker et al. method, we instead sample a transformed variable v = − log u . Applying a change of variables, q$_{v}$ ( v ) = q ( u ) exp ( − v ) . With q$_{v}$ ( v ) denoting the “true” CDF of v , let ̂ q$_{v}$ ( v ) be the empirical CDF of v after taking M proposal draws from g ($_{q}$) , and ordering the proposals 0 < v$_{1}$ < v$_{2}$ < . . . < v$_{M}$ < ¥ . To be clear, ̂ q$_{v}$ ( v ) is the proportion of samples that are strictly less than v . As M becomes large, the empirical approximation becomes more accurate. Because ̂ q$_{v}$ ( v ) is discrete, we can sample from a density proportional to q ( u ) exp ( − v ) by par- titioning the domain into M + 1 segments with the break point of each partition at each v$_{i}$ . The 6 2.2 Implementation p ($_{q}$ | u , y ) = p ($_{q}$ , u | y ) p ( u | y ) (12) = c$_{1}$ c$_{2}$ L ( y ) p ( u | y ) 1 [ u < F ($_{q}$ | y )] g ($_{q}$) (13)