Probability Theory 1.Basic concepts 2.Probability 3.Permutations 4.Combinations
Randomness l Experiments »Trial: execution of one experiment »Outcome: result of one experiment »Sample space (S): set of all possible outcomes »Sample size (n): number of trials »Not all outcomes the same due to randomness not predictable in a deterministic sense l Events »Sample space divided into events (A 1, A 2, A 3, …) »Union and intersection of events »Disjoint and complement events
Mean and Variance l Data: multiple measurements of same quantity l Represent data graphically using histogram l Definitions »Range: »Median: middle value when values are ordered according to magnitude »Properties »Outlier: data value that falls outside a certain number of standard deviations
Matlab: Histograms >> y = [ ]’; >> hist(y,9) histogram plot with 9 bins >> n = hist(y,9) store result in vector n >> x = [ ]’ >> n = hist(y,x) create histogram with bin centers specified by vector x >> mean(y) ans = >> var(y) ans = >> std(y) ans =
Definition of Probability l Simple definition for finitely many equally likely outcomes l Relative frequency l General definition: P(A j ) satisfies the following axioms of probability:
Basic Theorems of Probability l Complementation: l Addition rule for mutually exclusive events l Addition rule for arbitrary events l Conditional probability of A 2 given A 1 l Independent events
Probability Examples l Probability that at least one coin will turn heads up from five tossed coins »Number of outcomes: 2 5 = 32 »Probability of each outcome: 1/32 »Probability of no heads: P(A C ) = 1/32 »Probability at least one head: P(A) = 1-P(A C ) = 31/32 l Probability of getting an odd number or a number less than 4 from a single dice toss »Probability of odd number: P(A) = 3/6 »Probability of number less than 4: P(B) = 3/6 »Probability of both: »Probability of either:
Permutations l Permutation – arrangement of objects in a particular order l The number of permutations of n different objects taken all at a time is: n! = n l The number of permutations of n objects divided into c different classes taken all at a time is: l Number of permutations of n different objects taken k at a time is:
Permutation Examples l Box containing 6 red and 4 blue balls »Compute probability that all red balls and then all blue balls will be removed »n 1 = 6, n 2 = 4 »Probability l Coded telegram »Letters arranged in five-letter words: n = 26, k = 5 »Total number of different words: n k = 26 5 = 11,881,376 » Total number of different words containing each letter no more than once:
Combinations l Combination – selection of objects without regard to order l Binomial coefficients l Stirling formula: l Number of combinations of n different objects taken k at a time is:
Combination Examples l Effect of repetitions »Three letters a, b, c taken two at a time (n = 3, k = 2) »Combinations without repetition »Combinations with repetitions l 500 light bulbs taken 5 at a time »Repetitions not possible »Combinations
Matlab: Permutations & Combinations >> perms([2 4 6]) all possible permutations of 2, 4, >> randperm(6) returns one possible permutation of >> nchoosek(5,4) number of combinations of 5 things taken 4 at a time without repetitions ans = 5 >> nchoosek(2:2:10,4) all possible combinations of 2, 4, 6, 8, 10 taken 4 at a time without repetitions
Matlab: Categorical Arrays Label data in numerical arrays by category (e.g. color, size, species) Example: flipping 10 coins >> toss = ceil(2*rand(10,1)) randomly generate an integer = 1 or 2 10 times >> toss = nominal(toss,{'heads','tails'}) form a categorical array that replaces each value of 1 with ‘heads’ and 2 with ‘tails tails heads tails heads heads heads tails heads heads heads >> summary(toss) return the number of occurrences of each data label in the categorical array heads tails 7 3 Repeat 100 times and plot data in histogram >> tosses = nominal(ceil(2*rand(10,100)),{'heads','tails'}) >> T = summary(tosses) >> hist(T’,9)