I am trying to sample a piecewise power law distribution: $$ \ f(x) = \begin{cases} a_1x^{-\alpha_1} & \text{if } x_1 \leq x \leq \tilde{x} \newline a_2x^{-\alpha_2} & \text{if } \tilde{x} \leq x \leq x_2 \newline \end{cases} \ $$ I want to make this distribution continuous in $\tilde{x}$ so I obtain $a_1 = a_2 \tilde{x}^{ \alpha_1 - \alpha_2} $. Thus I have: $$ \ f(x) = \begin{cases} a_2 \tilde{x}^{ \alpha_1 - \alpha_2} x^{-\alpha_1} & \text{if } x_1 \leq x \leq \tilde{x} \newline a_2x^{-\alpha_2} & \text{if } \tilde{x} \leq x \leq x_2 \newline \end{cases} \ $$ To fix $a_2$, I use the normalization of $F(x) = \int_{x_1}^{x_2} f(x) \,dx = 1$. For the simple case (not piecewise) I just pick a random number $u \in [0, 1]$ and then plug in the inverse of $F(x)$. In this case, I don't know how to continue since I cannot figure out which function to use when I pick a $u$. Furthermore, if I pick some $u$ such that the corresponding $x$ is $x > \tilde{x}$, I need to use only the $F(x)$ corresponding to $x > \tilde{x} $ or I need to use the $F(x)$ for $x < \tilde{x} $ summed with $F(x)$ for $x > \tilde{x} $.
1 Answer
You can see this distribution as a mixture of two power law distributions, $$f(x)=\alpha f_1(x) + (1-\alpha) f_2(x)$$ with $$f_1(x)=\frac{𝑥^{−a_1}\mathbb I_{x_1\le x\le \tilde x}} {\underbrace{\int_{x_1}^{\tilde x} y^{−a_1}\,\text dy}_{\frac{1}{a_1-1}[x_1^{1-a_1}-\tilde x^{1-a_1}]}} \qquad f_2(x)=\dfrac{𝑥^{−𝛼_2}\mathbb I_{x_2\ge x\ge \tilde x}}{\underbrace{\int^{x_2}_{\tilde x} y^{−a_2}\,\text dy}_{\frac{1}{a_2-1}[\tilde x^{1-a_2}-x_2^{1-a_2}]}}$$ and \begin{align}\alpha&=\tilde x^{a_1−a_2}\frac{1}{a_1-1}[x_1^{1-a_1}-\tilde x^{1-a_1}]\Big/\\ &\quad\left\{\tilde x^{a_1−a_2}\frac{1}{a_1-1}[x_1^{1-a_1}-\tilde x^{1-a_1}]+\frac{1}{a_2-1}[\tilde x^{1-a_2}-x_2^{1-a_2}]\right\}\end{align} Simulating from $f$ can thus be done by
- selecting between $f_1$ and $f_2$ with probabilities $\alpha$ and $1-\alpha$
- simulating from the resulting (truncated) power law