How to calculate the expected distribution of results using random numbers?












1












$begingroup$


See this SO thread: Calculating which item is next in a percentage distribution.



To summarize,



you calculate



max ((rand1 * 10), (rand2 * 20), (rand3 * 30), (rand4 * 40))


for four random numbers in a range (say 1-100).



If the max is



rand1 * 10, you choose 'A'
rand2 * 20, you choose 'B'
rand3 * 30, you choose 'C'
rand4 * 40, you choose 'D'


What is the expected distribution of choosing A, B, C and D?



How to derive it mathematically?



(Using some C code, the percentages come out to be 1, 10, 31 and 56 respectively)










share|cite|improve this question











$endgroup$












  • $begingroup$
    What is the distribution of the random numbers?
    $endgroup$
    – Rasmus
    Sep 5 '10 at 14:40










  • $begingroup$
    @Rasmus: uniform distribution (each has equal probability), forgot to mention this.
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:48
















1












$begingroup$


See this SO thread: Calculating which item is next in a percentage distribution.



To summarize,



you calculate



max ((rand1 * 10), (rand2 * 20), (rand3 * 30), (rand4 * 40))


for four random numbers in a range (say 1-100).



If the max is



rand1 * 10, you choose 'A'
rand2 * 20, you choose 'B'
rand3 * 30, you choose 'C'
rand4 * 40, you choose 'D'


What is the expected distribution of choosing A, B, C and D?



How to derive it mathematically?



(Using some C code, the percentages come out to be 1, 10, 31 and 56 respectively)










share|cite|improve this question











$endgroup$












  • $begingroup$
    What is the distribution of the random numbers?
    $endgroup$
    – Rasmus
    Sep 5 '10 at 14:40










  • $begingroup$
    @Rasmus: uniform distribution (each has equal probability), forgot to mention this.
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:48














1












1








1


1



$begingroup$


See this SO thread: Calculating which item is next in a percentage distribution.



To summarize,



you calculate



max ((rand1 * 10), (rand2 * 20), (rand3 * 30), (rand4 * 40))


for four random numbers in a range (say 1-100).



If the max is



rand1 * 10, you choose 'A'
rand2 * 20, you choose 'B'
rand3 * 30, you choose 'C'
rand4 * 40, you choose 'D'


What is the expected distribution of choosing A, B, C and D?



How to derive it mathematically?



(Using some C code, the percentages come out to be 1, 10, 31 and 56 respectively)










share|cite|improve this question











$endgroup$




See this SO thread: Calculating which item is next in a percentage distribution.



To summarize,



you calculate



max ((rand1 * 10), (rand2 * 20), (rand3 * 30), (rand4 * 40))


for four random numbers in a range (say 1-100).



If the max is



rand1 * 10, you choose 'A'
rand2 * 20, you choose 'B'
rand3 * 30, you choose 'C'
rand4 * 40, you choose 'D'


What is the expected distribution of choosing A, B, C and D?



How to derive it mathematically?



(Using some C code, the percentages come out to be 1, 10, 31 and 56 respectively)







calculus linear-algebra probability






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited May 23 '17 at 12:39









Community

1




1










asked Sep 5 '10 at 10:25









LazerLazer

75521017




75521017












  • $begingroup$
    What is the distribution of the random numbers?
    $endgroup$
    – Rasmus
    Sep 5 '10 at 14:40










  • $begingroup$
    @Rasmus: uniform distribution (each has equal probability), forgot to mention this.
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:48


















  • $begingroup$
    What is the distribution of the random numbers?
    $endgroup$
    – Rasmus
    Sep 5 '10 at 14:40










  • $begingroup$
    @Rasmus: uniform distribution (each has equal probability), forgot to mention this.
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:48
















$begingroup$
What is the distribution of the random numbers?
$endgroup$
– Rasmus
Sep 5 '10 at 14:40




$begingroup$
What is the distribution of the random numbers?
$endgroup$
– Rasmus
Sep 5 '10 at 14:40












$begingroup$
@Rasmus: uniform distribution (each has equal probability), forgot to mention this.
$endgroup$
– Lazer
Sep 6 '10 at 4:48




$begingroup$
@Rasmus: uniform distribution (each has equal probability), forgot to mention this.
$endgroup$
– Lazer
Sep 6 '10 at 4:48










2 Answers
2






active

oldest

votes


















2












$begingroup$

The probabilities are given by:



$p_i = int_0^1 prod_{j in {1,2,3,4}, jne i} min(frac{ix}{j},1) dx, i = 1, 2, 3, 4$



each factor in the integrand computes the probability density that the i-th random variable is larger than the j-th one.



The exact result is



[1/96, 31/288 91/288 163/288]






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Can you please mention how to derive this? That would be more useful.
    $endgroup$
    – Lazer
    Sep 5 '10 at 14:13










  • $begingroup$
    Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
    $endgroup$
    – David Bar Moshe
    Sep 5 '10 at 15:42



















1












$begingroup$

Suppose you only had three random numbers between 0 and 1. Point (x,y,z)=(rand1*10,rand2*20,rand3*30) falls uniformly inside parallelepiped with dimensions 10,20,30.
Sets x>y&&x>z, y>x&&y>z, z>x&&z>y partition this parallelepiped into 3 parts, as pictured below, and their relative volumes represent the fraction of the time that x, y or z are the maximum value, respectively. Working out expression for the volumes should give you the integral expression David gave above.








share|cite|improve this answer











$endgroup$













  • $begingroup$
    wow! nice explanation and diagrams! how did you generate these figures?
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:47










  • $begingroup$
    Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
    $endgroup$
    – Yaroslav Bulatov
    Sep 6 '10 at 5:51













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f4058%2fhow-to-calculate-the-expected-distribution-of-results-using-random-numbers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2












$begingroup$

The probabilities are given by:



$p_i = int_0^1 prod_{j in {1,2,3,4}, jne i} min(frac{ix}{j},1) dx, i = 1, 2, 3, 4$



each factor in the integrand computes the probability density that the i-th random variable is larger than the j-th one.



The exact result is



[1/96, 31/288 91/288 163/288]






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Can you please mention how to derive this? That would be more useful.
    $endgroup$
    – Lazer
    Sep 5 '10 at 14:13










  • $begingroup$
    Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
    $endgroup$
    – David Bar Moshe
    Sep 5 '10 at 15:42
















2












$begingroup$

The probabilities are given by:



$p_i = int_0^1 prod_{j in {1,2,3,4}, jne i} min(frac{ix}{j},1) dx, i = 1, 2, 3, 4$



each factor in the integrand computes the probability density that the i-th random variable is larger than the j-th one.



The exact result is



[1/96, 31/288 91/288 163/288]






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Can you please mention how to derive this? That would be more useful.
    $endgroup$
    – Lazer
    Sep 5 '10 at 14:13










  • $begingroup$
    Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
    $endgroup$
    – David Bar Moshe
    Sep 5 '10 at 15:42














2












2








2





$begingroup$

The probabilities are given by:



$p_i = int_0^1 prod_{j in {1,2,3,4}, jne i} min(frac{ix}{j},1) dx, i = 1, 2, 3, 4$



each factor in the integrand computes the probability density that the i-th random variable is larger than the j-th one.



The exact result is



[1/96, 31/288 91/288 163/288]






share|cite|improve this answer











$endgroup$



The probabilities are given by:



$p_i = int_0^1 prod_{j in {1,2,3,4}, jne i} min(frac{ix}{j},1) dx, i = 1, 2, 3, 4$



each factor in the integrand computes the probability density that the i-th random variable is larger than the j-th one.



The exact result is



[1/96, 31/288 91/288 163/288]







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Sep 5 '10 at 12:10

























answered Sep 5 '10 at 12:01









David Bar MosheDavid Bar Moshe

1,83298




1,83298












  • $begingroup$
    Can you please mention how to derive this? That would be more useful.
    $endgroup$
    – Lazer
    Sep 5 '10 at 14:13










  • $begingroup$
    Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
    $endgroup$
    – David Bar Moshe
    Sep 5 '10 at 15:42


















  • $begingroup$
    Can you please mention how to derive this? That would be more useful.
    $endgroup$
    – Lazer
    Sep 5 '10 at 14:13










  • $begingroup$
    Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
    $endgroup$
    – David Bar Moshe
    Sep 5 '10 at 15:42
















$begingroup$
Can you please mention how to derive this? That would be more useful.
$endgroup$
– Lazer
Sep 5 '10 at 14:13




$begingroup$
Can you please mention how to derive this? That would be more useful.
$endgroup$
– Lazer
Sep 5 '10 at 14:13












$begingroup$
Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
$endgroup$
– David Bar Moshe
Sep 5 '10 at 15:42




$begingroup$
Consider four random variables R1, R2, R3, R4 uniformly distrbuted in [0,1]. The probability space is a four dimensional hypercube of length 1. Consider for example the case C, where 3R3 is required to be the maximal. Suppose that R3 = x,the probability that 3R3 exceeds 2R2 is 3x/2 if x<2/3 and 1 if x>=2/3 because probabilities cannot exceed 1. All the factors in the integral are constructed according to this rule. The probabilities are multiplied because 3R3 is required to be greater than x1 and 2R2 and 4R4 and the integration is because x can take any value between zero and one uniformly.
$endgroup$
– David Bar Moshe
Sep 5 '10 at 15:42











1












$begingroup$

Suppose you only had three random numbers between 0 and 1. Point (x,y,z)=(rand1*10,rand2*20,rand3*30) falls uniformly inside parallelepiped with dimensions 10,20,30.
Sets x>y&&x>z, y>x&&y>z, z>x&&z>y partition this parallelepiped into 3 parts, as pictured below, and their relative volumes represent the fraction of the time that x, y or z are the maximum value, respectively. Working out expression for the volumes should give you the integral expression David gave above.








share|cite|improve this answer











$endgroup$













  • $begingroup$
    wow! nice explanation and diagrams! how did you generate these figures?
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:47










  • $begingroup$
    Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
    $endgroup$
    – Yaroslav Bulatov
    Sep 6 '10 at 5:51


















1












$begingroup$

Suppose you only had three random numbers between 0 and 1. Point (x,y,z)=(rand1*10,rand2*20,rand3*30) falls uniformly inside parallelepiped with dimensions 10,20,30.
Sets x>y&&x>z, y>x&&y>z, z>x&&z>y partition this parallelepiped into 3 parts, as pictured below, and their relative volumes represent the fraction of the time that x, y or z are the maximum value, respectively. Working out expression for the volumes should give you the integral expression David gave above.








share|cite|improve this answer











$endgroup$













  • $begingroup$
    wow! nice explanation and diagrams! how did you generate these figures?
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:47










  • $begingroup$
    Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
    $endgroup$
    – Yaroslav Bulatov
    Sep 6 '10 at 5:51
















1












1








1





$begingroup$

Suppose you only had three random numbers between 0 and 1. Point (x,y,z)=(rand1*10,rand2*20,rand3*30) falls uniformly inside parallelepiped with dimensions 10,20,30.
Sets x>y&&x>z, y>x&&y>z, z>x&&z>y partition this parallelepiped into 3 parts, as pictured below, and their relative volumes represent the fraction of the time that x, y or z are the maximum value, respectively. Working out expression for the volumes should give you the integral expression David gave above.








share|cite|improve this answer











$endgroup$



Suppose you only had three random numbers between 0 and 1. Point (x,y,z)=(rand1*10,rand2*20,rand3*30) falls uniformly inside parallelepiped with dimensions 10,20,30.
Sets x>y&&x>z, y>x&&y>z, z>x&&z>y partition this parallelepiped into 3 parts, as pictured below, and their relative volumes represent the fraction of the time that x, y or z are the maximum value, respectively. Working out expression for the volumes should give you the integral expression David gave above.









share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Dec 27 '18 at 21:48









Glorfindel

3,41981830




3,41981830










answered Sep 5 '10 at 17:04









Yaroslav BulatovYaroslav Bulatov

1,87411526




1,87411526












  • $begingroup$
    wow! nice explanation and diagrams! how did you generate these figures?
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:47










  • $begingroup$
    Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
    $endgroup$
    – Yaroslav Bulatov
    Sep 6 '10 at 5:51




















  • $begingroup$
    wow! nice explanation and diagrams! how did you generate these figures?
    $endgroup$
    – Lazer
    Sep 6 '10 at 4:47










  • $begingroup$
    Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
    $endgroup$
    – Yaroslav Bulatov
    Sep 6 '10 at 5:51


















$begingroup$
wow! nice explanation and diagrams! how did you generate these figures?
$endgroup$
– Lazer
Sep 6 '10 at 4:47




$begingroup$
wow! nice explanation and diagrams! how did you generate these figures?
$endgroup$
– Lazer
Sep 6 '10 at 4:47












$begingroup$
Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
$endgroup$
– Yaroslav Bulatov
Sep 6 '10 at 5:51






$begingroup$
Mathematica -- RegionPlot3D[x>=y&&x>=z,{x,0,10},{y,0,20},{z,0,30}]
$endgroup$
– Yaroslav Bulatov
Sep 6 '10 at 5:51




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f4058%2fhow-to-calculate-the-expected-distribution-of-results-using-random-numbers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Quarter-circle Tiles

build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

Mont Emei