For a sociology class project you are asked to conduct a survey on 20 students at your school. You decide to stand outside of your dorm’s cafeteria and conduct the survey on a random sample of 20 students leaving the cafeteria after dinner one evening. Your dorm is comprised of 45% males and 55% females.
Negative Binomial is most appropriate; each student represents an independent “trial” with dichomotous outcome (male or female). The kth (and last) success is defined as the student being female, and probability of success in each trial is constant.
p<-.55
n<-4
k<-2
p_4thFem<-(factorial(n-1)/(factorial(k-1)*factorial(n-k)))*(p^k)*((1-p)^(n-k))
The probability that the 4th person is the 2nd female is \({n-1\choose k-1}p^k (1-p)^{(n-k)}={4-1\choose2-1}(.55)^2 (1-.55)^{4-2}=\frac{3!}{1!2!}(.55)^2 (.45)^2=\) 0.184.
bin_coefficient<-(factorial(3)/(factorial(1)*factorial(2)))
The binomial coefficient is \({n\choose k}={3\choose1}=\frac{3!}{1!2!}=\) 3.
The last trial’s success is defined as the last student being female in the negative binomial distribution which is determined by including the binomial coefficient, which returns the number of combinations of the first 3 trials. In (c) we calculated the number of ways to order 2 males and 1 female (3 trials); in (b) we calculated the probability that the 4th trial would be a success.