Discrete distribution problem

Hi sci, I have a problem I need help solving.

I have a given set of data [2, 4, 5, 7, 10] and the expected value or the mean of E(x) = 6. How would I get the probabilities of each value in this set based on this formula E(x) = 2 * P(2) + 4 * P(4) + 5 * P(5) + 7 * P(7) + 10 * P(10) or E(X) = Xi * P(Xi), P(Xi) is the probability for a given X

Other urls found in this thread:

en.wikipedia.org/wiki/List_of_optimization_software
twitter.com/NSFWRedditGif

P(X=5)=P(X=7)=1/2
P(X=anything else)=0

You're welcome.

Also

P(X=2)=P(X=10)=1/2
P(X=anything else)=0

You're welcome.

Hmm..

The thing is I need a formula to generate this models dynamically, meaning the values in the set are always changing and I can't use a static model

So your problem is in fact:

Let [math]x_1,…,x_5\in\mathbb{N}[/math]. Find a random variable [math]X[/math] such that [math]\mathbb{E}(X)=6[/math]

?

Even in this form it doesn't really make sense since the integers could all be 1 and it would be impossible. Are all integers distinct? Can you guarantee that [math]\min_i x_i \le 6 \max_i x_i[/math] ?

It should be [math]\min_i x_i \le 6 \le \max_i x_i[/math] ?

min x < mean < max x, not all x are distinct.
There may be a couple with the same value

but yes there will always be values smaller and greater than the mean

also P(xi) > 0

Then essentially you have to do what I did in my first post. From the five numbers, take one that is less or equal to 6, one that is greater or equal to 6. Let a and b be these numbers. Solve linear problem:

[math]ax+by=6[/math]
[math]x+y=1[/math]

If you didn't drop out of linear algebra you'll have the solutions x=P(X=a) and y=P(X=b). It'll be a discrete distribution on the set of numbers if you put P(X=anything else then a or b)=0.

Now if you want a "nicer" distribution that is > 0 for all numbers, you won't be able to do it in general.

Is there really no way, I absolutely need to have probability for each value to be > 0.
Is there really no way?

You have a set of data? If so, you can find (with R) how often each number relatively occurs.

How would that help me? The values are generally unique, but thats not a must

You don't have a unique solution here. You can come up with any reasonable values for the first 5 possible events, then use the expected value equation to calculate the sixth.

Choosing the probabilities of all but one event automatically chooses the probability of the one left out since the sum of the probabilities has to sum to 1. So doing this will never give you a distribution.

There is no guarantee of even one solution the the linear problem since you have the constrain that all probabilities must be positive and less or equal to 1.

Sorry what I meant to say is that doing this will never give you an expected value of 6. But it will be a distribution.

I realize thats the case when dealing with free parameters, tho Im still interested if there is a way to find the optimized function that produces optimized probabilities

Would there be a way to do this by approximating the probabilities to the absolute value of variables

You can reformulate it as an optimization problem like:

[eqn] \begin{matrix} \max & p_2 p_4 p_5 p_7 p_{10} \\
\text{s.t.} & p_2 + p_4 + p_5 + p_7 + p_{10} = 1 \\
& 2 p_2 + 4 p_4 + 5 p_5 + 7 p_7 + 10 p_{10} = 6 \\
& p_2, p_4, p_5, p_7, p_{10} \geq 0 \end{matrix} [/eqn]

Let your computer solve this in the usual way and then set [math] P(X_i) = p_i [/math].

Here you would get
[math] P(2) = 0.16598 \ldots [/math]
[math] P(4) = 0.18141 \ldots [/math]
[math] P(5) = 0.19025 \ldots [/math]
[math] P(7) = 0.21080 \ldots [/math]
[math] P(10) = 0.25155 \ldots [/math]

Ok this is great, how do I replicate this?

What software do I use for this?

There is lots of software for that
en.wikipedia.org/wiki/List_of_optimization_software