A commuter train from Long Island to New York City is scheduled to arrive at 8:07 A.M. every weekday morning. The probability that the train arrives on time is 0.90. Suppose 20 weekdays are randomly selected. Using R to calculate Binomial Probabilities.
Find the expected number of days that the train will arrive on time.
Let
p : Prob. of success = P ( Train will arrive on time ) = 0.90
n = number of days randomly selected.
The random variable X is defined as
X : Number of days that the train will arrive on time.
random variable x takes value 0,1,2,.........,20
The probability mass function of random variable X is
To find binomial probabiliies using R.
> x =0 :20
> p =0.90
> n =20
> prob=dbinom(x,n,p)
> d=data.frame("X" = x, " Probability"=
prob)
> d
X X.Probability
1 0 1.000000e-20
2 1 1.800000e-18
3 2 1.539000e-16
4 3 8.310600e-15
5 4 3.178804e-13
6 5 9.154957e-12
7 6 2.059865e-10
8 7 3.707758e-09
9 8 5.422595e-08
10 9 6.507115e-07
11 10 6.442043e-06
12 11 5.270763e-05
13 12 3.557765e-04
14 13 1.970454e-03
15 14 8.867045e-03
16 15 3.192136e-02
17 16 8.977883e-02
18 17 1.901199e-01
19 18 2.851798e-01
20 19 2.701703e-01
21 20 1.215767e-01
since X ~ Bin ( n= 20,p =0.90)
E(X) = np = 20 *0.9 = 18
Expected number of days that the train will arrive on time = 18 days.
Get Answers For Free
Most questions answered within 1 hours.