Expected value and variance of max{x, y}

867 Views Asked by At

I've run into this problem while playing a game called Europa Universalis 4. I've done similar maths before in my studies so I'm pretty sure this should have an easy answer but I can't for the life of me remember how to do it.

In this game there are monarchs. Each monarch has 3 stats each determined by 2d4 - 2 die rolls. That's rolling two dice ranging 1-4 and subtracting 2 from the result, giving non-uniform distribution from 0 to 6. For simplicity I just count all 3 stats up as equals, so that makes 6d4 - 6 for their total stat, ranging 0 to 18 or in mathematical terms, I suppose this would be $$ Monarch Points = -6 + \sum_1^6 Xi $$ $$ Xi = Uniformly Discretely(1,4) $$

The problem is as follows: I am comparing Government form A, where I get a randomly generated monarch from the method above, to Government B, where I get two randomly generated monarchs from the method above and pick the best one. Obviously, government B is better, but by how much? To get a meaningful answer I'm trying to compare the expected value and variances, but I'm pulling a complete blank here.

2

There are 2 best solutions below

0
On

You may answer this via brute force; it's simple since your variables are discrete and independent.

I'm going to answer a slightly simpler question. Consider the sum of two 4-sided dice. Probability for discrete variables is the outcome divided by the number of events in the sample space. Thus you get:

Let X be the sum of two 4 sided dice; then there are 8 - 1 = 7 outcomes, with probs (recall there are 16 = 4*4 events in the sample space)

P(X = 2) = 1/16 = {(1,1)}
P(X = 3) = 2/16 = {(1,2), (2,1)}
P(X = 4) = 3/16 = {(1,3), (2,2), (3,1)}
P(X = 5) = 4/16 = {(1,4), (2,3), (3,2), (4,1)}
P(X = 6) = 3/16 = {(2,4), (3,3), (4,2)}
P(X = 7) = 2/16 = {(3,4), (4,3)}
P(X = 8) = 1/16 = {(4,4)}

so E is the sum of x * P(x) for all x in the sample space, ie:

{2*1 + 3*2 + 4*3 + 5*4 + 6*3 + 7*2 + 8*1}/16 = 5

and the variance is similarly defined.

Now, to your question, we can simply brute force the answer. Here's some R code:

# note the na in P(1) to make indexing easier
probs <- c(NA,1,2,3,4,3,2,1)/16

# E of single var
E <- 0
for( x in 2:8)
    E <- E + x * probs[x]
print(sprintf('E is %f', E))

# E of max of 2 vars
E <- 0
for(x in 2:8){
    for(y in 2:8){
        E <- E + max(x,y) * probs[x] * probs[y]
    }
}
print(sprintf('E of max is %f', E))

ie the expectation is 5.890625 so 0.89 better.

2
On

A slightly more mathematical answer: if you have two independent random variables $X$ and $Y$, one way to begin analyzing $Z \equiv \max \{ X,Y \}$ is to compute its CDF:

$$F_Z(z) = \mathbb{P} \left ( \left \{ \omega \in \Omega : \max \{ X(\omega),Y(\omega) \} \leq z \right \} \right ) \\ = \mathbb{P} \left ( \left \{ \omega \in \Omega: X(\omega) \leq z \land Y(\omega) \leq z \right \} \right ) \\ = F_X(z) F_Y(z) $$

where the last line uses the independence. In this problem this is a bit messy because $F_X$ jumps at $24-5=19$ different points, but it is still doable, albeit easier with a computer.