0
$\begingroup$

Suppose we have a random variables with values from 1 to 1000 and we have to assign exponential increasing values to them (1 has low probability and 1000 has highest but increase in probabilities is exponential). How can i write equation for this.

Second how can i randomly pick any one of the a random variables with chances that highest probability random variable is most likely to be returned.

Let me rephrase the problem, It is same as in https://stackoverflow.com/questions/10942318/random-numbers-based-on-a-probability only difference i explain here

considering S is random number generated to map to the numbers following exponential growth rate (exponential probability increase) for n=1 S=1 or 2 for n=2 S=3 or 4 or 5 or 6 (S=2pow(n) ) and so. How i can solve now with arithmetic series formula ( i think it is must ) as shown in link above for exponential distribution to get n .

$\endgroup$
4
  • $\begingroup$ What do you mean by “highest probability random variable”? Do you actually mean the highest probability value of the random variable you define in the first part of the question? That value will be the most likely value by definition. $\endgroup$
    – David K
    Oct 31, 2018 at 21:54
  • $\begingroup$ Let me rephrase the problem, It is same as in $\endgroup$ Nov 1, 2018 at 5:49
  • $\begingroup$ I think there is a misunderstanding of the language of probability here. I do not think you actually want multiple random “variables”; I think you need just one random variable that has $1000$ possible values. If you talk of $1000$ random variables you will be talking about something very different than the other example. $\endgroup$
    – David K
    Nov 1, 2018 at 12:26
  • $\begingroup$ Regarding the second paragraph, I think what you asked for is not what you want. Reading the question literally, we could give you any random procedure in which $1000$ is the most likely outcome. For example $1000$ could be the result $1/2$ of the time and otherwise we choose equally likely from $1$ to $999.$ Technically that would satisfy what you asked for. But I think what you want is a procedure in software that will accurately simulate the random distribution you described. That is a much more specific request. $\endgroup$
    – David K
    Nov 1, 2018 at 12:34

2 Answers 2

0
$\begingroup$

For some $0 \le \alpha \le 1$, You can assign a probability of $\alpha$ to 1000, $\alpha^2$ to 999, ..., $\alpha^{1000}$ to 1. To make this a legitimate probability distribution (a probability mass function, strictly speaking), the probabilities must add up to 1. This implies:

$\sum_{n=1}^{1000} \alpha^n = \frac{\alpha(1-\alpha^{1000})}{1-\alpha} = 1$. You can solve numerically in a program like MATLAB or Python to calculate the value of $\alpha$ which satisfied this equation. Since the summation converges to $\frac{1}{1-\alpha}$, your answer will be very close to $\alpha = 0.5$.

$\endgroup$
0
$\begingroup$

In general you have an exponentially increasing probability on the integers $1$ to $n$ as long as the probability of each number $k$ ($k \neq 1$) is greater than the previous number $k-1$ and the ratio of those two numbers is the same fixed ratio for every $k.$

(Note: In the specific question asked above, $n=1000.$)

In other words, you need to set some fixed ratio $r$ such that $P(2)=r\cdot P(1),$ $P(3)=r^2\cdot P(1),$ $P(4)=r^3\cdot P(1),$ and so forth.

If you do this up to $P(n)=r^{n-1}\cdot P(1)$ and then say $n$ is the largest possible outcome and there are no others, by the law of total probability you must have \begin{multline} P(1)+P(2)+P(3)+P(4)+\cdots+P(n)=\\ P(1) + r\cdot P(1)+ r^2\cdot P(1) + r^3\cdot P(1) + \cdots + r^{n-1}\cdot P(1) = 1. \end{multline}

This implies that $$ P(1)=\frac{1}{1+r+r^2+r^3+\cdots+ r^{n-1}} =\frac{r-1}{r^{n}-1}. $$

So you can set $r$ to any number you like greater than $1$, such as $r=2$ or $r=10$ or even $r=1.005,$ then set $P(1)$ according to the equation above, and then set all the other probabilities as described.

To simulate your distribution in software, a standard method for any probability distribution over the numbers $1$ to $n$ is to compute the cumulative distribution function for every possible outcome. That is, for each possible value $k$, you compute the sum of probabilities $P(1)+P(2)+P(3)+P(4)+\cdots+P(k).$ Since you have an exponentially increasing distribution, however, it will often be more accurate to compute $1-P(n)-P(n-1)-\cdots-P(k+1),$ which is the same thing mathematically but reduces some numerical errors in the computer. In any case the cumulative distribution function is always exactly $1$ at the largest possible random value, $n.$

Continuing the method, you put all the sums of probabilities into an array in increasing sequence. You then use a pseudorandom function such as rand() to generate a pseudorandom floating-point number (not an integer!) in the range $0.0$ to $1.0.$ Next, use binary search to find the smallest number in the array that is still greater than or equal to the output of rand(). Binary search is recommended because it is generally much faster than looking at each number in sequence within the array. Take the position of that number within the array; in most programming languages this will be an integer from $0$ to $n-1.$ Add $1$ to that integer to get your final “random number” in the range $1$ to $n$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .