In: Statistics and Probability
Suppose you have an experiment where you flip a coin three times. You then count the number of heads.
A coin tossed three times.
The sample space is given by
S = { (H, H, H), (H, H, T), (H, T, H), (H, T, T), (T, H, H), (T, H, T), (T, T, H), (T, T, T)}
The random variable X is defined as
X: number of heads in three tosses.
X takes values 0,1, ,2 and 3.
The probability distribution of X is
X | 0 | 1 | 2 | 3 | Total |
P(X=x) | 1/8 | 3/8 | 3/8 | 1/8 | 1 |
E(X) = 0 * 1/8 + 1 /3/8 + 2*3/8 + 3 *1/8
= 3/8 + 6/8 + 3/8 = 1.5
Mean= 1.5.
Variance of number of heads is given by
E(X2) = 0 * 1/8 + 1* 3/8 + 4* 3/8 + 9* 1/8
= 3/8 + 12/8 + 9/8
= 3
Var(X) = 3 - 2.25 = 0.75
Var(X) = 0.75
Standard deviation of number of heads
SD(X) = sqrt(Var(X)) = sqrt(0.75) = 0.8660.
P ( Having two or more number of heads) = P ( X > = 2)
= P(X=2) + P(X=3)
= 3/8 + 1/8
=0.5.
P ( Having two number of heads ) = P(X=2) = 3/8 = 0.375.
Since P ( X=2) = 0.375 > 0.05 hence it is not unusual.
For drawing histogram we need to draw random sample from binomial distribution with n = 3 and p = 0.5
by using R
> r= rbinom(100,3,0.5)
> hist(r)
> table(r)
r
0 1 2 3
14 30 41 15