Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Probability and combinatorics Notes from www.math.uah.edu/stat/ Virtual Laboratories in Probability and Statistics Discrete probability distributions List of mutually exclusive and exhaustive outcomes of some process and their probabilities Example - 1 coin toss Outcome: Head Tail Probability: 1/2 1/2 Example - 1 fair die throw #spots: 1 2 3 4 5 6 Probability: 1/6 1/6 1/6 1/6 1/6 1/6 This is an example of a discrete uniform distribution Uniform distribution and counting . Atoms 1 2 . . N Probability: 1/N 1/N 1/N 1/N 1/N 1/N •P(A) = N(A)/N •e.g. A = get less than 3 when you roll a dice •P(A) = P(1) + P(2) = 2/6 •So calculation of probabilities counting •But counting can be complicated. Need rules Multiplication rule for ordered events • Flying from LA to NY and back • How many airline combinations are possible? • E.g. (American, United), (United, American), (United, United) • These are called ordered pairs • Rule: If the first element of the pair can happen in n1 ways and for each of these ways, the second element can happen n2 ways, then the total no. of possibilities is n 1 n2 Probabilities using product rule • A license number consists of two letters (uppercase) followed by five digits. 1. How many different license numbers are there? 2. If a license number is chosen at random, find the probability that the digits are all less than 5. • Total license nos. = 26*26*105 • Valid license nos.=26*26*45 • P(all digits < 5) = Valid license nos./Total license nos. • = (4/10)5 = 0.01024 Obstetricians and paediatricians • • • • • Family needs to choose from 2 clinics: Clinic 1 has 2 obs and 2 paed Clinic 1 has 2 obs and 3 paed How many combos are possible? Unequal nos. of possibilities Tree diagrams P1 P2 P1 O1 O2 P1 O3 Total ways = 2+2+3+3 P3 O4 P4 P5 P3 P4 P5 Permutations • • • • • Sample space S with n elements Want to choose an ordered sequence of k No of ways possible= nPk nPk= n(n-1)(n-2)…(n-k+1) In statistics this is called sampling without replacement • A special form of pigeonhole principle Arrangement problem Twelve books, consisting of 5 math books, 4 science books and 3 history books are randomly arranged on a bookshelf. 1. How many outcomes are there? 2. Find the probability that the books of each type are together. 3. Find the probability that the math books are together. Combinations • • • Consider a sample space S with n elements. A combination of size k from S is an (unordered) subset {x1, x2, ..., xk} of S with k (distinct) elements C(n,k) = nPk/k! This is also sampling without replacement, but order is ignored Games of chance A poker hand consists of 5 cards dealt without replacement and without regard to order from a deck of 52 cards. 1. Show that the number of poker hands is 2,598,960. 2. Find the probability that a random poker hand is a full house (3 cards of one kind and 2 of another kind) 0.001440576 3. Find the probability that a random poker hand has 4 of a kind. 0.000240096 Independence • Events X and Y are said to be independent if the probability that X occurs is not affected by whether or not Y has occurred. • Examples of independent events: • • • • It can be shown that independence implies: P(X and Y) = P(X)P(Y) (and not otherwise) This is called the multiplication rule for independent events. Example: 2 security guards • • • • • • Guard 1: answers pager 80% of the time Guard 2: answers pager 50% of the time What is the probability i) they both respond to a call? ii) at least one responds to a call? X= event guard 1 answers; Y= guard 2 answers • What can we say about X and Y? Tree models to calculate probabilities DISCRETE DISTRIBUTIONS Example - Family of 3 children. Let X = number of girls Possible values: X = 3 GGG X = 2 GGB GBG BGG X = 1 BBG BGB GBB X = 0 BBB Assume the 8 outcomes are equally likely so that x 0 1 2 3 P(X = x) 1/8 3/8 3/8 1/8 P(X x) Probability Distribution of a Discrete r.v. • The probabilities may be written as: P( X xi ) pi for i 1,2,..., k and 0 pi 1 k p 1 i i 1 •P(Xi=xi) is also referred to as the density function f(x) •The cumulative distribution function (c.d.f.) is defined as i F ( xi ) P( X xi ) p j j 1 Example - Bernoulli trials Each trial is an 'experiment' with exactly 2 possible outcomes, "success" and "failure" with probabilities p and 1-p. Let X = 1 if success, 0 if failure Probability distribution is x P(X = x) 0 p 1 1-p • Results for Bernoulli trials can be simulated using S-PLUS • e.g. simulate results of a drug trial drug, success (cure) has probability p = 0.3 for each patient, 100 patients in trial. • result _ rbinom(100, size=1, prob=p) • result is a 100 vector that looks like 1,0,0,1,0,1,…... Example-Binomial Experiment • • • • • • • • Generalisation of Bernoulli trials X ~ Bin(n,p) X = # of successes in n Bernoulli trials e.g. X = # of heads in 10 tosses of a coin, n = , p = e.g. X = # of boys in a family of 5 children, n= , p = e.g. X = # of sixes in 100 rolls of a dice, n= , p= possible values for X = probability distribution for X (q = 1-p) n P(X = k) = p k q n k k n k nk p q k 0 k n Shape of the Binomial Distribution • The shape of the binomial distribution depends on the values of n and p. • probdistr_ dbinom(x=0:n, size=n, prob=p) Prob. Distr. for Bin(10,0.5) 0.0 0.0 0.05 0.05 0.10 0.10 0.15 0.15 0.20 0.20 0.25 0.25 Prob. Distr. for Bin(15,0.8) 0 2 4 6 no. of successes 8 10 0 5 10 no. of successes 15 Example - 2 dice are thrown Let X denote the sum of the results. Outcomes: 11 21 31 41 51 61 12 22 32 42 52 62 13 23 33 43 53 63 14 24 34 44 54 64 15 25 35 45 55 65 16 26 36 46 56 66 Assume the 36 outcomes are equally likely so each has probability = 1/36 Possible values of X are 2, 3, ... , 12 e.g. P(X = 4) = P(1,3 or 2,2 or 3,1) = 3/36 . The probability distribution is x 2 P(X=x) 1/36 3 4 2/36 3/36 ... ... 10 11 12 3/36 2/36 1/36