Assume that 13% of people are left handed. If we select 5 people at random, find the probability below: a) the first lefty is the fifth person chosen = .0745 b) the first lefty is the second or third person = .211 How do you solve both problems in R?
a)
Let X be the number of person chosen until we get the first lefty. Then X will follow Geometric distribution with the parameter p = 0.13. That is X ~ Geometric(p = 0.13)
The PMF of X is,
P(X = k) = (1 - 0.13)k-1 * 0.13 = 0.13 * 0.87k-1 for k = 1, 2, ..
Using R, you can use either above PMF or Geometric distribution function to get the value.
> 0.13 * 0.87^(5-1)
[1] 0.07447669
or,
> dgeom(4, 0.13)
[1] 0.07447669
You need to pass x = 4 in dgeom function as the x is defined as number of failures for geometric distribution defined in R. So, to find the 5th person as lefty, we have found 4 (failures) right handed person.
b)
Probability that the first lefty is the second or third person = P(X = 2) + P(X = 3)
= 0.13 * 0.872-1 + 0.13 * 0.873-1
Using R, you can use either above PMF or Geometric distribution function to get the value.
> 0.13 * 0.87^(2-1) + 0.13 *
0.87^(3-1)
[1] 0.211497
or,
> dgeom(1, 0.13) + dgeom(2, 0.13)
[1] 0.211497
As in part (a), number of failures are x = 1 or x = 2.
Get Answers For Free
Most questions answered within 1 hours.