Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Simulation of Exp-Abs-xy

Target distribution:

f(x,y)∝exp⁡(−∣x∣−∣y∣−a∣y−x∣) .f(x, y)\propto \exp(-\vert x\vert -\vert y\vert - a\vert y-x\vert)\,.

Gibbs:

  • f(x∣y)∝exp⁡(−∣x∣−a∣y−x∣)f(x\mid y)\propto \exp(-\vert x\vert - a\vert y-x\vert)

  • f(y∣x)∝exp⁡(−∣y∣−a∣y−x∣)f(y\mid x)\propto \exp(-\vert y\vert - a\vert y-x\vert)

Accept-Reject

f(x∣y)∝exp⁡(−∣x∣−a∣y−x∣)≤exp⁡(−a∣x−y∣)f(x\mid y)\propto \exp(-\vert x\vert - a\vert y-x\vert)\le \exp(-a\vert x - y\vert)
using Distributions
a = 10
f(x, y) = exp( -abs(x) - a * abs(y-x) )
g(x, y) = exp(-a * abs(x-y))

function gibbs_ar(N::Int)
    x = ones(N+1)
    y = ones(N+1)
    for i = 2:(N+1)
        xstar = rand(Laplace(y[i-1], 1/a))
        if rand() < f(xstar, y[i-1]) / g(xstar, y[i-1])
            x[i] = xstar
        else
            x[i] = x[i-1]
        end

        ystar = rand(Laplace(x[i], 1/a))
        if rand() < f(x[i], ystar) / g(x[i], ystar)
            y[i] = ystar
        else
            y[i] = y[i-1]
        end
    end
    return x, y
end
svg

Inverse CDF

Refer to the handwritten supplementary for detailed derivation.

svg

Slice Sampling

f(x,y)∝exp⁡(−∣x∣−∣y∣−a∣x−y∣)=∫0∞Iu1≤exp⁡(−∣x∣)du1∫0∞Iu2≤exp⁡(−∣y∣)du2∫0∞Iu3≤exp⁡(−a∣x−y∣)du3f(x, y)\propto \exp(-\vert x\vert - \vert y\vert - a\vert x- y\vert) = \int_0^\infty \mathbb{I}_{u_1\le\exp(-\vert x\vert)}du_1\int_0^\infty \mathbb{I}_{u_2\le\exp(-\vert y\vert)}du_2\int_0^\infty \mathbb{I}_{u_3\le\exp(-a\vert x-y\vert)}du_3

Then

x∣y,u1,u2,u3∼f(x∣y,u1,u2,u3)∝Iu1≤exp⁡{−∣x∣}Iu3≤exp⁡{−a∣x−y∣}y∣x,u1,u2,u3∼f(y∣x,u1,u2,u3)∝Iu2≤exp⁡{−∣y∣}Iu3≤exp⁡{−a∣x−y∣}u1∣x∼U(0,exp⁡{−∣x∣})u3∣x,y∼U(0,exp⁡{−a∣x−y∣})u2∣y∼U(0,exp⁡{−∣x∣})\begin{align*} x|y,u_1,u_2,u_3&\sim f(x|y,u_1,u_2,u_3)\propto\mathbb{I}_{u_1\le\exp\{-|x|\}}\mathbb{I}_{u_3\le\exp\{-a|x-y|\}}\\ y|x,u_1,u_2,u_3&\sim f(y|x,u_1,u_2,u_3)\propto\mathbb{I}_{u_2\le\exp\{-|y|\}}\mathbb{I}_{u_3\le\exp\{-a|x-y|\}}\\ u_1|x&\sim\mathcal U(0,\exp\{-|x|\})\\ u_3|x,y&\sim\mathcal U(0,\exp\{-a|x-y|\})\\ u_2|y&\sim\mathcal U(0,\exp\{-|x|\})\\ \end{align*}

It is straightforward to use the following Julia program to simulate.

Reference

Conditional distribution of $\exp(-|x|-|y|-a \cdot |x-y|)$ - Cross Validated

Last updated