## Description

Lab 2: Calculating Probabilities and Plotting Distributions

1 Sampling Without Replacement

In Module 1 Section 1.2 we did the computer coding example to illustrate sampling without replacement (check pages 89–95 or slides 39–41). The calculations can be simplified using phyper, dhyper R functions that compute the cdf and pmf of the hypergeometric distribution. Type ?dhyper in R for help.

Task 1a: Redo the calculations on page 95 (slide 41) using these functions.

Task 1b: Plot the probabilities of 0,1,…10 improvable lines of code in the sample using plot R function. Type ?plot for help.

Task 1c: Now suppose that the total number of lines of code from which the sample of size 10 is taken is (a) 1000, (b) 100 or (c) 50, whilst the total number of improvable lines of code remains the same at 30. Plot the probabilities for each of (a), (b) and (c) on the one plot. Comment on the differences between the probabilities.

2 Bayes Theorem — Sampling Without Replacement

Task 2a: Follow the method and calculations in Module 1 Section 1.3 to work out the answer to the probability that, given an observed number of 5 lines of code that could be improved in the 20 sampled, the total number of lines of code that could be improved out of 1,000 was 0,1,2,…,1000 (check the derivations on pages 148–164 or slides 61–65) Task 2b: Plot these probabilities.

Task 2c: What do you think about whether the code meets the standard on the basis of 5 lines of code in the sample of 20 that could be improved? What happens if the observed number was 0 or 1? Comment.

3 Binomial Probabilities

Task 3: Work out the R commands to produce the Binomial plots given in Module 2 Section 1 (check page 68 or slide 23).

Workshop

1. Let P(A) = 0.4 and P(A ∪ B) = 0.6.

a. What is the value of P(B) if A and B are mutually exclusive?

b. What is the value of P(B) if A and B are independent?

2. A box contains 5 green balls, 3 black balls, and 7 red balls. Two balls are selected atrandom without replacement from the box. What is the probability that:

a. both balls are red?

b. both balls are of the same colour?

c. one ball is red and the other is black?

Try to find the above probabilities using two ways: one through a classical probability model and counting formulas, and the other through conditional probabilities/multiplication rule.

3. The probability that a marksman hits a target is 0.9 on any given shot, and repeated shotsare independent. He has two pistols; one contains two bullets and the other contains only one bullet. He selects a pistol at random and shoots at the target until the pistol is empty. What is the probability of hitting the target exactly one time?

4. Let A1 and A2 be the events that a person is left eye dominant and right eye dominant, respectively. When a person folds his/her hands, let B1 and B2 be the events that their left thumb and right thumb, respectively, are on top. A survey in one statistics class yielded the following table.

B1 B2 Totals

A1 5 7 12

A2 14 9 23

Totals 19 16 35

If a student is selected randomly, find the following probabilities:

a. P(A1 ∩ B1),

b. P(A1 ∪ B1),

c. P(A1|B1),

d. P(B2|A2).

5. Each of three football players will attempt to kick a field goal from the 25-yard line. LetAi denote the event that the field goal is made by player i, i = 1,2,3. Assume that A1, A2 and A3 are mutually independent and that P(A1) = 0.5, P(A2) = 0.7, P(A3) = 0.6.

a. Compute the probability that exactly one player is successful.

b. Compute the probability that exactly two players make a field goal (i.e., one misses).

6. Lie detectors are controversial instruments, barred from use as evidence in many courts.Nonetheless, many employers use lie detector screening as part of their hiring process in the hope that they can avoid hiring people who might be dishonest. There has been some research, but no agreement, about the reliability of polygraph tests. Based on this research, suppose that a polygraph can detect 65% of lies, but incorrectly identifies 15% of true statements as lies.

A certain company believes that 95% of its job applicants are trustworthy. The company gives everyone a polygraph test, asking “Have you ever stolen anything from your place of work?” Naturally, all the applicants answer “No”, but the polygraph identifies some of those answers as lies, making the person ineligible for a job. What is the probability that a job applicant rejected under suspicion of dishonesty was actually trustworthy?

7. Game Show ParadoxSuppose you’re on a game show, and you’re given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say number 1, and the host, who knows what’s behind the doors, opens another door, say number3, which has a goat. He says to you, ”Do you want to pick door number 2?” Is it to your advantage to switch your choice of doors?

8. Suppose events A and B satisfy P(A∩B) = P(A)P(B). Show that they are independent by calculating all the relevant probabilities.

9. Suppose that the genes for eye colour for a certain male fruit fly are (R,W) and the genes for eye colour for the mating female fruit fly are (R,W), where R and W represent red and white, respectively. Their offspring receive one gene for eye colour from each parent.

a. Define the sample space for the genes for eye colour for the offspring.

b. Assume that each of the four possible outcomes has equal probability. If an offspringends up with either two red genes or one red and one white gene for eye colour, its eyes will look red. Given that an offspring’s eyes look red, what is the conditional probability that it has two red genes for eye colour?

10. (Q1.4-9) An urn contains four coloured balls: two orange and two blue. Two balls are selected at random without replacement, and you are told that at least one of them is orange. What is the probability that the other ball is also orange?

11. A life insurance company issues standard, preferred, and ultra-preferred policies. Of thecompany’s policyholders of a certain age, 60% are standard with a probability of 0.01 of dying in the next year, 30% preferred with a probability of 0.008 of dying in the next year, and 10% are ultra-preferred with a probability of 0.007 of dying in the next year. A policyholder of that age dies in the next year. What are the conditional probabilities of the deceased being standard, preferred, and ultra-preferred?

12. Let a chip be taken at random from a bowl that contains 6 white chips, 3 red chips, and1 blue chip. Let the random variable X = 1 if the outcome is a white chip; let X = 5 if the outcome is a red chip; and let X = 10 if the outcome is a blue chip.

a. Find the pmf of X. (Namely, find the possible values of X and then the probability for each such possible value.)

b. Find the expectation of X.

13. Let 4. Find the value of c so that f(x) satisfies the conditions of being a pmf for a random variable X.

14. Let f(x) = (1/4)|x|(1/2)1−|x| for x = −1,0,1 and f(x) = 0 for other x values. Is f(x) a pmf? If yes, re-express the pmf by a table.

## Reviews

There are no reviews yet.