Home About us Mathematical Epidemiology Rweb EPITools Statistics Notes Web Design Contact us Links |
Value (x) | P(X=x) | xP(X=x) |
0 | 1 × 0.43 | 0 |
1 | 3 × 0.42 × 0.6 | 0.288 |
2 | 3 × 0.4 × 0.62 | 0.864 |
3 | 1 × 0.63 | 0.648 |
Value (y=x2) | P(Y=y=x2)=P(X=x) | yP(Y=y)=x2P(X=x) |
0 | 1 × 0.43 | ? |
1 | 3 × 0.42 × 0.6 | ? |
4 | 3 × 0.4 × 0.62 | ? |
9 | 1 × 0.63 | ? |
> z1 <- rbinom(25000,size=3,prob=0.6)
> z1sq <- z1*z1
> mean(z1sq)
This should be fairly close to 3.96. The average of a lot of squared
values should be close to the expectation value of the square. By
the way, the expectation value of the square of a random quantity
is called the second moment.