# Thread: Moments of a random variable involving numerous Binomial Distributions

1. ## Mean, Variance, Skew, and Kurtosis of X

I am editing my post because it might have been unclear.

Suppose X is a random variable involving 4 binomially distributed random variables:

X = y1(p, 1/2 (a + b)) - y2((1 - p), 1/2 (a + b)) + y3((1 - p),1/2 (a - b)) - y4(p, 1/2 (a - b))

I wish to find the mean, variance, skew, and kurtosis of X, and I believe I have found the correct mean using the formula for the mean of a binomially distributed random variable, np.

E(X) = (p 1/2 (a + b)) - ((1 - p) 1/2 (a + b)) + ((1 - p) 1/2 (a - b)) - (1/2 p (a - b))
E(X) = b (-1 + 2 p)

Now I am using the formula for variance, p(1-p), to find Var(X), but I am not sure I am correct:

Var(X) = (p (1 - p) 1/2 (a + b)) + ((1 - p) (1 - (1 - p)) 1/2 (a + b)) + ((1 - p) (1 - (1 - p)) 1/2 (a - b)) + (p (1 - p) 1/2 (a - b))
Var(X) = -2 a (-1 + p) p

I am not sure my calculation is correct, because I have a reference who believes the correct answer for Var(X) is -4 a (-1 + p) p.

Is there anyone here on Talk Stats who is able to help me? I would really appreciate it.

Thank you.

2. ## Re: Mean, Variance, Skew, and Kurtosis of X

Two things you can do when this situation occurs
1) use symbolic solver https://www.symbolab.com/solver/
copy paste the large equation you have and get the result you have
2) simulate X and estimate variance and compare it to the result of you're formula

3. ## Re: Moments of a random variable involving numerous Binomial Distributions

Thank you Jesper,

I have physical access to Mathematica, but mentally not much (yet!). Do you know if Mathematica can solve my problem?

Have a great day!

4. ## Re: Moments of a random variable involving numerous Binomial Distributions

I do not know Mathematica, but according to the solver i linked to your answer is correct, so unless you have another problem as well I would consider it solved.

5. ## Re: Moments of a random variable involving numerous Binomial Distributions

Hi Jesper,

While the calculation simplifies to what you and I both got, the formula for variance that I have used is wrong. I simulated via MATLAB and got twice the answer, which is exactly what my reference has.

So the problem remains. What is the correct formula for variance?

6. ## Re: Moments of a random variable involving numerous Binomial Distributions

Can you show your simulation code?

7. ## Re: Moments of a random variable involving numerous Binomial Distributions

I think you are making simulation mistake. My simulation fits the formula not multiplying with 4 but with 2. So as Dason says pls. post code for your simulation.

 Tweet