0
$\begingroup$

I am trying to find the variance but I don't know how to calculate $E(X^2)$, but I do have a process that will enable me to find $E(X)$. How can I find $E(X^2)$?

In my case I have two 6-sided dice, which when thrown sum to D. Then I throw D 15-sided dice and its sum is S. I want to find the variance of S. I can find the expected value by doing (2*3.5)*8 but I don't know how to get the expected value of the square so I can subtract the two to find the variance.

I know it's around 504 but just trying to understand how to calculate it. I also know $E(X)$ here is 56, so $E(X^2)$ is around 560, but how to get the ~560?

  • 0
    Can anyone show the algebra involved?2012-06-16

4 Answers 4

3

The comments have clarified this question significantly. To summarize, we roll 2 6-sided dice and sum the results to get a result $D$, then roll a 15 sided dice $D$ times, summing the results to get $X$. The question is, what is the variance of $X$?

The governing equation is:

$\mathbb{V}[X] = \mathbb{E}_D[\mathbb{V}[X|D]] + \mathbb{V}_D[\mathbb{E}[X|D]]$

Now, $\mathbb{V}[X|D] = D\mathbb{V}[X|D=1]$, as we are just summing up the 15-sided dice. So the first term on the r.h.s. above is $\mathbb{E}[D] \mathbb{V}[X|D=1]$. As $\mathbb{E}[X|D] = D\mathbb{E}[X|D=1]$, once again because we are just summing, the second term on the r.h.s. above is $\mathbb{V}[D]\mathbb{E}[X|D=1]^2$.

The expectation and variance of a discrete uniform variate on $\{1, 2, \dots, N\}$ are $(N+1)/2$ and $(N^2-1)/12$ respectively. Plugging in 6 and 15 in all the appropriate places, and remembering that we are rolling two dice to give us $D$, results in $\mathbb{E}[D] = 7$, $\mathbb{V}[X|D=1] = 224/12$, $\mathbb{V}[D] = 35/6$, and $\mathbb{E}[X|D=1]=8$, for a final result of 504.

Writing a little R script to check:

DiceRoll <- function(n) sample(1:n,1)  x <- rep(0,100000) for (j in 1:length(x)) {   n <- DiceRoll(6) + DiceRoll(6)   for (i in 1:n) x[j] <- x[j] + DiceRoll(15) }  var(x) [1] 504.4255 

which looks like a pretty good confirmation that we haven't messed up anywhere.

  • 0
    But can i use variance and ev of old systems to find those variables for the new system recursively?2012-06-16
1

$\newcommand{\var}{\operatorname{var}} \newcommand{\E}{\mathbb{E}}$ jbowman has already mentioned the law of total variance, but I think the matter can be stated more simply than in that answer.

$ \var(S) = \var(\E(S\mid D)) + \E(\var(S\mid D)). $ I.e. the total variance of $S$ is the variance of the conditional expected value plus the expected value of the conditional variance. Below I'll say something about what that means.

You throw two 6-sided dice and get a number $D$ in the set $\{2,3,4,\ldots,12\}$, with respective probabilities $1/36, 2/36, 3/36, 4/36, 5/36, 6/36, 7/36, 6/36, 5/36,4/36,3/36,2/36,1/36$. We have $\E(D)=7$ and $\var(D)=35/6$.

Now suppose you throw a 15-sided die. You get a mean of $8$ and a variance of $56/3$ (if my hasty arithmetic is right).

If you throw $d$ 15-sided dice and sum the outcomes, you have a mean of $8d$ and a variance of $56d/3$.

So the conditional expected value of the sum $S$ given the event that $D=d$ is $8d$ and the conditional variance of the sum $S$ given the event that $D=d$ is $56d/3$. I.e. $ \E(S\mid D=d) = 8d,\qquad \var(S\mid D=d)=\frac{56d}{3}. $

Next we have $\E(S\mid D)$ and $\var(S\mid D)$ as random variables in their own right, since they depend on the random variable $D$, and we get: $ \E(S\mid D) = 8D, \qquad \var(S\mid D)= \frac{56D}{3}. $

So $ \E(\var(S\mid D)) = \E\left(\frac{56D}{3}\right) = \frac{56}{3} \E(D) = \frac{56}{3}\cdot 7 = \frac{392}{3}, $ and $ \var(E(S\mid D)) = \var(8D) = 8^2\var(D) = 64\cdot \frac{35}{6} = \frac{1120}{3}. $

Now add: $ \frac{392}{3} + \frac{1120}{3} = \frac{1512}{3} = 504. $

Later note: $\var(\E(S\mid D))$ is the part of the variance of $S$ that is "explained" by the variability of $D$. The other term, $\E(\var(S\mid D))$ is the part of the variance of $S$ that comes from the randomness that remains in $S$ after $D$ is determined, so it's the "unexplained" component of the variance of $S$.

  • 1
    What if i have multiple systems? I got the 504 but what if it's deeper?2012-06-16
1

Another problem to point out with the premise of the question is that for an arbitrary random variable $X$ there is literally no relationship whatsoever between $E(X)$ and $E(X^2)$. The easiest way to see this might be to take a variable $X$ that has probability $\frac{1}{2n+1}$ of being each of the numbers $-n, -n+1, \ldots, 0, \ldots, n-1, n$. Then the expected value of $X$ itself, is obviously zero, but $E(X^2) = \frac{1}{2n+1}\sum_{i=-n}^ni^2 = n(n+1)/3$; the value of $E(X)$ (which is always 0) tells us nothing at all about the value of $E(X^2)$ (which varies with $n$ and can be arbitrarily large). It's impossible to compute $E(X^2)$ from $E(X)$, so you have to go through at least some semblance of the computation that other answers here have outlined.

0

Well, the good news is that if you can find $E(X)$ you should be able to find $E(X^2)$.

Given that you have a 2-stage discrete process, perhaps it would help you to visually "chart" out the possibilities for S. You should be able to then see how to calculate

$E(X)=\sum_i x_ip(x_i)$

If I understand the problem correctly, you have to roll N 6-sided dice and then roll $M=\sum_in_i$ 15-sided dice in order to find the moments of the second process.

Steps/hints

-Create your discrete pmf for the first RV

-Use this to create a discrete pmf of the second RV

-Use this pmf to calculate $E(X),E(X^2).$

The "trick" here is to recall (or observe) that the $E(Y)$ can be thought of as a collection of $E(Y|X=x)$-type outcomes that should be relatively easy to compute. While in this case a 15-sided die is slightly more difficult to deal with, it doesn't change the methodology from the below example.

Simplified example

Suppose you flip a coin and then roll 1 die if it comes up heads and 2 dice if it comes up tails. What is $E$(dice roll)?

It should be easy to see that the first process has a simple pmf that is $\frac12$ for heads and tails. Under the event $(Y|X=0)$, for $0$="heads", $E(Y)=\frac16(1+2+\cdots+6)=3.5$ while the event $(Y|X=1)$ yields $E(Y)=\sum_{i=2}^{12}x_ip(x_i)=7.$

Think about what $E(Y)$ is in this simplified case, and think about how this would impact a complete pmf for Y.

Then extrapolate.

  • 0
    "Solve for" isn't really the right term if you mean "find" or evaluate". If I have the equation $3x+5=20$, I can _solve for_ $x$. If I know that $x = 1+2+3+4+5$, I can _find_ $x$.2012-06-16