Just a warning, I may use improper terms here. If you think I'm explaining something wrong, it's quite possible that I am. Just let me know.
I'm trying to calculate the second moment for a binomial distribution. E(y^2), where Y ~ Binom.
I have two different methods, both of which I believe should work, but I'm getting different results. Could someone help me find which one I've done incorrectly?
V(Y) = E(y^2) - E(y)^2
==> npq = E(y^2) - (np)^2
==> E(y^2) = np(q + np)
The second method I'm using is with the second moment of the moment generating function.
My thinking is that if I take the MGF for the binomial distribution, take its derivative, and set t = 0, I should get E(y^2)
mgf = (p*e^t + q)^n
mgf(first derivative) = n*p*e^t*(p*e^t + q)^(n-1)
mgf(first derivative, t = 0) = n*p*(p + q)^(n-1)
mgf(first derivative, t = 0) = n*p
Obviously these both can't be right. I'm thinking the first one is correct, but where did I mess up?
I'm trying to calculate the second moment for a binomial distribution. E(y^2), where Y ~ Binom.
I have two different methods, both of which I believe should work, but I'm getting different results. Could someone help me find which one I've done incorrectly?
V(Y) = E(y^2) - E(y)^2
==> npq = E(y^2) - (np)^2
==> E(y^2) = np(q + np)
The second method I'm using is with the second moment of the moment generating function.
My thinking is that if I take the MGF for the binomial distribution, take its derivative, and set t = 0, I should get E(y^2)
mgf = (p*e^t + q)^n
mgf(first derivative) = n*p*e^t*(p*e^t + q)^(n-1)
mgf(first derivative, t = 0) = n*p*(p + q)^(n-1)
mgf(first derivative, t = 0) = n*p
Obviously these both can't be right. I'm thinking the first one is correct, but where did I mess up?