12
$\begingroup$

I feel really dumb even asking such a basic question but here goes:

If I have a random variable $X$ that can take values $0$ and $1$, with $P(X=1) = p$ and $P(X=0) = 1-p$, then if I draw $n$ samples out of it, I'll get a binomial distribution.

The mean of the distribution is

$\mu = np = E(X)$

The variance of the distribution is

$\sigma^2 = np(1-p)$

Here is where my trouble begins:

Variance is defined by $\sigma^2 = E(X^2) - E(X)^2$. Because the square of the two possible $X$ outcomes don't change anything ($0^2 = 0$ and $1^2 = 1$), that means $E(X^2) = E(X)$, so that means

$\sigma^2 = E(X^2) - E(X)^2 = E(X) - E(X)^2 = np - n^2p^2 = np(1-np) \neq np(1-p)$

Where does the extra $n$ go? As you can probably tell I am not very good at stats so please don't use complicated terminology :s

$\endgroup$
  • 1
    $\begingroup$ If $X=X_1+X_2+\cdots +X_n$ and these are independent then $E[X^2]=E[X_1^2+X_1X_2 +\cdots+X_1X_n+X_2X_1+X_2^2+\cdots]=n(n-1)p^2 +np$. But an even easier route is $E[X_1]^2=p$ so $Var[X_1]=p-p^2$ so with independence $Var[X_1+X_2+\cdots+X_n]=n(p-p^2)$ $\endgroup$ – Henry May 16 '17 at 10:45
24
$\begingroup$

A random variable $X$ taking values $0$ and $1$ with probabilities $P(X=1)=p$ and $P(X=0)=1-p$ is called a Bernoulli random variable with parameter $p$. This random variable has \begin{eqnarray*} E(X)&=&0\cdot (1-p) + 1\cdot p = p\\ E(X^2)&=&0^2\cdot(1-p) + 1^2\cdot p = p\\ Var(X)&=& E(X^2)-(E(X))^2=p-p^2=p(1-p) \end{eqnarray*} Suppose you have a random sample $X_{1},X_{2},\cdots,X_{n}$ of size $n$ from $Bernoulli(p)$, and define a new random variable $Y=X_{1}+X_{2}+\cdots +X_{n}$, then the distribution of $Y$ is called Binomial, whose parameters are $n$ and $p$. The mean and variance of the Binomial random variable Y is given by \begin{eqnarray*} E(Y)&=&E(X_{1}+X_{2}+\cdots + X_{n})=\underbrace{ p+p+\cdots +p}_{n}=np\\ Var(Y)&=& Var(X_{1}+X_{2}+\cdots + X_{n})=Var(X_{1})+Var(X_{2})+\cdots + Var(X_{n})\\ & &\text{ (as $X_{i}$'s are independent)} \\ &=&\underbrace{p(1-p)+p(1-p)+\cdots+ p(1-p)}_{n}\quad \text{ (as $X_{i}$'s are identically distributed)} \\ &=&np(1-p) \end{eqnarray*}

$\endgroup$
  • 1
    $\begingroup$ How does this answer the question, which was "Where does the extra n go?"? $\endgroup$ – amoeba May 16 '17 at 14:26
  • $\begingroup$ @amoeba Thank you very much for your comment. As OP could not distinguish between Bernoulli and Binomial random variables, I thought of reminding him the necessary definitions and the process of obtaining the required expressions. $\endgroup$ – L.V.Rao May 16 '17 at 14:46
  • 1
    $\begingroup$ I am just saying that your answer would (in my opinion) improve if you explicitly point out the mistake in OP's reasoning. Your answer derives the correct formulas, but does not show where OP went wrong. $\endgroup$ – amoeba May 16 '17 at 14:47
  • $\begingroup$ @amoeba True. Giving some direction, making them correct themselves also helps sometimes. $\endgroup$ – L.V.Rao May 16 '17 at 14:50
11
$\begingroup$

Two mistakes in your proving process:

1: $X$ in first paragraph has different definition comparing with $X$ in the rest of article.

2: Under the condition that $X$ ~ $Bin(p, n)$, $E(X^2) \ne E(X)$. Try to work from $E(X^2) = \sum {\left(x^2\Pr(X=x)\right)}$

$\endgroup$
  • 2
    $\begingroup$ If you like making your eyes bleed, I transcribed a lot of my notes from grad school. This particular link shows the derivation of E(X) and E(X^2) nutterb.github.io/ItCanBeShown/… $\endgroup$ – Benjamin May 15 '17 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.