520 likes | 876 Views
Module 2: Probability . Outline . basic probability definitions random variables probability distributions and densities expected values. Probability. When we perform experiments, there is a random component.
E N D
Module 2: Probability K. McAuley
Outline • basic probability definitions • random variables • probability distributions and densities • expected values K. McAuley
Probability • When we perform experiments, there is a random component. • Even if we are careful, different results will be obtained when we repeat an experiment. • We want to understand, quantify and model the types of variations that we encounter. K. McAuley
Probability Definitions Experiment • situation leading to a value • could be an actual planned experiment, or any circumstance in which values are observed • e.g., gold recovery from an ore sample • e.g., atmospheric concentration of phenol • e.g., consumer preferences from a survey • an experiment has outcomes Sample Space • the set of all possible outcomes from an experiment • e.g,. {appealing, acceptable, unappealing} • e.g., a range of real numbers for temperature • Sample space is denoted by “S” K. McAuley
Probability Definitions Events are collections of outcomes. • An event has occurred if at least one of the outcomes in the event has occurred. • A single outcome is also an event • e.g., E = {chip is defective} • e.g., E = {car finish is metallic, car finish is matte} • We can talk about the intersection and union of events • e.g., if E1={car is red, car is green, car is blue} and E2={car is not red}, then what is the intersection of E1 and E2? E1E2 = ? K. McAuley
Visualizing Events We can use Venn diagrams to visualize events: S Sample space E2 E1 E1 E2 K. McAuley
Set Operations • union • union of two events is the total set of outcomes occurring in either event • intersection • intersection of two events is the set of outcomes that occur in both events • complement • the complement of an event E is the set of events in the sample space that are not in E What does E1 E2 look like on the Venn diagram? What about the complement of E1 E2 ? K. McAuley
Mutually Exclusive Events Two events are mutually exclusive if they can’t occur together K. McAuley
Examples • Temperature in a reactor • sample space (-273.15 C, ) • event E1 - temperature below 350 °C, E1 = {T350} • event E2 - temperature above 300 °C, E2 = {T>300} • E1E2 = ? • E1E2 = ? • Reactor temperature is a continuous random variable K. McAuley
Examples • defects in samples of 5 chips from a chip foundry • sample space = { nnnnn, dnnnn, ndnnn, nndnn, nnndn, nnnnd, ddnnn, nddnn,… ddddd} • event E1, one of the first two chips in the sample is defective and the rest are not, E1 = ? • event E2 - at most one chip is defective, E2 = ? • event E3, no defective chips, E3 = ? • E1E2 = ? • E3 E1 = ? • Chip quality is a discrete random variable. K. McAuley
Probability Definitions Probability • indicates relative frequency, or likelihood, of a certain event occurring Axioms of Probability • required for consistency • P(S) = 1 • if E1 and E2 are mutually exclusive, P(E1 E2) = P(E1) + P(E2) K. McAuley
Additional Probability Facts • Probability of nothing happening • Probability of an event NOT happening • where the prime denotes “complement” K. McAuley
Additional Probability Facts Probability of a union of events Why do we subtract this? What happens to this term if events are mutually exclusive? K. McAuley
How can we determine probabilities? • By examining the sample space and counting • Determine the frequency of different outcomes using some assumptions • e.g., probability of rolling two sixes in a row is 1/36. • Use permutations and combinations • physical observation • e.g., temperatures appear to occur in a pattern that follows a normal probability distribution K. McAuley
Probability functions for discrete random variables Equally Likely Outcomes If we have N equally likely outcomes, then If we have an event consisting of several equally likely outcomes, i.e., E={outcome1, outcome2, outcome3} then K. McAuley
Probability functions for discrete random variables More generally, if we have an event consisting of equally likely individual outcomes, then where n(E) is the number of outcomes in E, and n(S) is the number of outcomes in the sample space S. K. McAuley
Multiplication Rule Assume we have two operations that are independent.If the first operation can be performed n1 ways, and the second operation can be performed n2 ways, then both operations together can be performed n1*n2 ways. e.g., number of ways to select a woman with a white shirt and a man with a black shirt from the class. K. McAuley
Additional Counting Rules • Permutations • selecting r objects from a total of n when order is important • Combinations • choosing r objects from a total of n when order is not important Why? Why? K. McAuley
Probability and Inter-relationships • Conditional Probability • Independence • Bayes’ Theorem K. McAuley
Conditional Probability What is the likelihood of an event E1 occurring, given that event E2 has occurred? Let’s talk about what this notation means Let’s look at a Venn diagram to figure out what is happening “given” K. McAuley
Conditional Probability What is the likelihood of an event E1 occurring, given that event E2 has occurred? K. McAuley
Example Galvanneal Line for coating steel with zinc has two quality tests: thickness and tape peel test Quality outcomes with probabilities - • O1: thickness off-spec, fails tape test -- 0.04 • O2: thickness acceptable, fails tape test -- 0.1 • O3: thickness off-spec, passes tape test -- 0.03 • O4: thickness acceptable, passes tape test -- 0.83 Events - • E1 = {fails tape test} • P(E1) = P(O1) + P(O2) = 0.14 • E2 = {fails thickness test} • P(E2) = P(O1) + P(O3) = 0.07 K. McAuley
Example Conditional Probability • What is the probability that given the zinc thickness is off-spec, the coil fails the tape test? K. McAuley
Independent Events Two events are independent if • intuitive interpretation • likelihood of one event occurring is not influenced by whether the other event has occurred • likelihood of both events occurring together is simply the product of the likelihood of each one occurring K. McAuley
Bayes’ Theorem • suppose we have two events A and B but What is it good for? K. McAuley
Bayes’ Theorem - Example Drug Testing at the Olympics - Reliability of analytical procedure • T -- positive test reading, D -- drug user • probability of true positive is 0.99 (correctly detects usage when individual is a drug user) -- P(T|D)=0.99 • probability of true negative is 0.94 (correctly detects non-usage when individual is not a drug user) -- P(T’|D’)=0.94 • suppose that 5% of population are drug users -- P(D) = 0.05 • if a positive reading is obtained, what is the probability that the individual is in fact a drug user? -- P(D|T) K. McAuley
Bayes’ Theorem - Example • From Bayes’ Theorem • P(T|D) = 0.99, P(T’|D’)=0.95, P(D)=0.05 • We can calculate probabilities of complement events • P(D’)=1-P(D)=1-0.05 = 0.95 • P(T|D’)=1-P(T’|D’)=1-0.94 = 0.06 We still need P(T). How can we get it? K. McAuley
Bayes’ Theorem - Example • putting it all together, • with a positive detection rate of 99%, and a false positive rate of 6%, there is a 46% chance that an individual is a drug user given a positive reading, when 5% of the population are drug users K. McAuley
Bayes’ Theorem • When we have some event B, and a range of mutually exclusive events E1, …, En that cover the sample space K. McAuley
Random Variable What is a random variable? • When experiments lead to categorical results, we assign numbers to the random variable: • e.g., defective = 0, functional = 1 Why do we assign numbers? • to help us to express probabilities and outcomes using mathematical expressions K. McAuley
Types of Random Variables Discrete Random Variables • take on integer values or other discrete sets of values Continuous Random Variables • take on values from a portion of the real line K. McAuley
Random Variables - Notation Random variable denoted by capital X Particular values obtained from an experiment are denoted by lower-case x K. McAuley
Discrete Random Variables • Notation for probability functions • Example - sampling one chip from a batch of 30, when 10 are defective. • defective = 0, functional = 1 K. McAuley
Cumulative Distribution Function We can also use Cumulative Distribution Functions • FX is the probability that we obtain an outcome less than or equal to a given number K. McAuley
Probability Function - Example Galvanneal Line example revisited • discrete random variable - attach score (number) to reflect outcomes x=0, 1, 2 -- “acceptability score” • O1: thickness off-spec, fails tape test x = 0 • O2: thickness acceptable, fails tape test x = 1 • O3: thickness off-spec, passes tape test x = 1 • O4: thickness acceptable, passes tape test x = 2 • interpretation - score reflects severity of situation in descending order Probability Function P(X=0) = 0.04, P(X=1) = 0.13, P(X=2) = 0.83 K. McAuley
Expected Value • What is the value of the random variable expected on average? • Let’s figure out the expected value of the outcome for testing of a sample from the Galvaneal line. • Maybe it will help to consider what would happen if we tested 1000 random samples K. McAuley
Expected Value The expected value of a discrete random variable X is defined as The expected value is given the symbol : • is called the MEAN of the random variable X. What is the expected number of buttons if we selected someone randomly from the class? K. McAuley
Example - Mean for Galvanneal Line • Using the probability function, What is E(X) when we are rolling a die? K. McAuley
Expected Values In general, if we have any function of a random variable, we can find the expected value of that function: • What is E(X3) when we roll a die? K. McAuley
Variance What is the expected squared deviation from the mean? • The sample variance s2 which is a statistic used to estimate the true variance 2 • What is 2 when we roll a die? • What is 2 for the number of buttons? K. McAuley
Standard Deviation … is the square root of the variance The mean, variance and standard deviation are parameters summarizing a probability distribution for a random variable. K. McAuley
Linearity of Expectation The Expected Value operation is LINEAR: • Additivity E(X+Y) = E(X) + E(Y) 2) Scaling E(kX) = k E(X) where k is a constant e.g., E(7X+6) = 7E(X) + 6 = 7X + 6 K. McAuley
Probability Distributions for Discrete R.V.’s • We can determine probability functions by counting • Some common situations result in • Binomial Distribution • Poisson Distribution K. McAuley
Binomial Distribution Suppose we are conducting a number of independent trials, each with only one of two possible values • Each trial is called a Bernoulli trial • Outcomes -- 0, 1 -- True/False -- Success/Fail -- ... • For each trial, P(1) = p, and P(0) = 1-p • If we have n trials, what is the probability that we obtain x successes (outcomes of 1)? Let’s figure it out using an example. K. McAuley
Binomial Distribution Putting it all together, the probability of having x successes in n independent trials is: Binomial Probability Distribution Function K. McAuley
Binomial Distribution Mean Variance How could we prove this? K. McAuley
Using the Binomial Distribution Sampling with Replacement - Example - On the microwave module line of a telecommunications equipment maker, the probability of a defective module is 0.21. From each batch, one module is selected and tested, and then returned to the batch. This procedure is repeated 5 times, so that we have 5 independent tests for defects. What is the probability of having : a) 1 defect in the five tests? b) 3 defects in the five tests? Why is it important that the module be returned? Would anyone really do this? K. McAuley
Binomial Example a) n = 5 (independent trials), x = 1 (“success” = defect identified) b) n = 5, x = 3 K. McAuley
Binomial Example Why is it necessary to return the module to the batch before the next sample? • preserve independence • if module not returned, chance of getting a defective module changes. • Binomial distribution is appropriate in sampling situations when there is “sampling with replacement” • for sampling without replacement, we need to use the Hypergeometric distribution • if the batch size is large, relative to the number of tests in the sample, binomial provides reasonable approximation • e.g., sampling 10 items from a population of 10000 K. McAuley