Integral substitution? In a recent economics paper (Rhodes and Wilson 2016), expected buyer surplus is computed as follows (page 8, (4)):
$$ v^*(q) = \int_{p^*(q)}^{b+q}[1-G(z-q)] dz$$
where $G(\cdot)$ is a distribution function.
I think that this basically computes:
$$ E(\varepsilon + q-p | \varepsilon > p-q) = \frac{\int_{p}^{b+q}(\varepsilon-p) g(\varepsilon) d\varepsilon }{1-G(p-q)}$$
How do you substitute for $\varepsilon$ with $z$ in order to get from my expression to their expression?
 A: The integral is the expected consumer surplus in equilibrium (those who do not buy get zero surplus):
$$\int^{p-q}_a0g(\varepsilon)d\varepsilon+\int_{p-q}^b(\varepsilon+q-p)g(\varepsilon)d\varepsilon=\int_{p-q}^b(\varepsilon+q-p)g(\varepsilon)d\varepsilon$$
Substituting $z-q=\varepsilon$ gives
$$\int_{p}^{b+q}(z-p)g(z-q)dz.$$
Integrating by parts, this is:
$$[(z-p)G(z-q)]_p^{b+q}-\int_p^{b+q}G(z-q)dz=(b+q-p)-\int_p^{b+q}G(z-q)dz$$
which is the expression they gave once you substitute $\int_{p}^{b+q}1\,dz=b+q-p$.

Note that your own integral is something different. Let $A$ be the event that consumer surplus is nonnegative: $$A=\{\varepsilon\in [a,b]\ | \ \varepsilon+q-p\geq 0\}.$$
The expected consumer surplus in equilibrium is:
$$E([\varepsilon+q-p]\mathbb{1}_A)$$
because those who do not buy get zero surplus.
You calculated something different: consumer's expected surplus conditional on it being nonnegative:
$$E(\varepsilon+q-p \ | \ A)$$
For example if consumer surplus is $-1$ with probability $1/2$ and $1$ with probability $1/2$, then the expected consumer surplus in equilibrium is:
$$\frac{1}{2}0+\frac{1}{2}1=\frac{1}{2}$$
while the consumer surplus conditional on it being positive is $1$.
