Harper George

2022-09-06

I have equation for truncated increasing geometric distribution given as $pr=\frac{\left(1-\alpha \right){\alpha }^{CW}}{1-{\alpha }^{CW}}.{\alpha }^{-r}$ with $r=1,.....,CW$. $\alpha$ is parameter we can set between 0 and 1.
Here probability of picking $r=1$ is very low and $r=CW$ is very high. How can i derive an equation from this equation that should give me values generated between $r=1$ and CW with given distribution.
i should get values like this if $r=1$ to 10. (following geometric distribution from equation provided)

Mckenna Friedman

Step 1
The standard way to generate a geometric variable with probability mass function $P\left(n\right)=\left(1-p\right){p}^{n}$ for $n\in {\mathbb{N}}_{0}$ from a variable u uniformly distributed over [0,1] is $n=⌊\frac{\mathrm{log}u}{\mathrm{log}p}⌋\phantom{\rule{thickmathspace}{0ex}}.$
Step 2
To restrict to $0\le n, we need to transform u to $\left[{u}_{0},1\right]$ such that $\frac{\mathrm{log}{u}_{0}}{\mathrm{log}p}=CW$. Thus ${u}_{0}={p}^{CW}$, so you can use $u\to 1-u\left(1-{p}^{CW}\right)$, and the formula for generating n becomes
$n=⌊\frac{\mathrm{log}\left(1-u\left(1-{p}^{CW}\right)\right)}{\mathrm{log}p}⌋\phantom{\rule{thickmathspace}{0ex}}.$
To map this to your case, take $r=CW-n$ and $p=\alpha$

Do you have a similar question?