8/30/2018 Department of Veterinary and Animal Sciences Advanced Quantitative Methods in Herd Management Probabilities and distributions Anders Ringgaard Kristensen Department of Veterinary and Animal Sciences Outline Probabilities Conditional probabilities Bayes’ theorem Distributions • Discrete • Continuous Distribution functions Sampling from distributions • Estimation • Hypotheses • Confidence intervals Slide 2 Department of Veterinary and Animal Sciences Probabilities: Basic concepts The probability concept is used in daily language. What do we mean when we say: • The probability of the outcome ”5” when rolling a dice is 1/6? • The probability that cow no. 543 is pregnant is 0.40? • The probability that USA will attack North Korea within 5 years is 0.05? Slide 3 1
8/30/2018 Department of Veterinary and Animal Sciences Interpretations of probabilities At least 3 different interpretations are observed: • A “frequentist” interpretation: • The probability expresses how frequent we will observe a given outcome if exactly the same experiment is repeated a “large” number of times. The value is rather objective. • An objective belief interpretation: • The probability expresses our belief in a certain (unobservable) state or event. The belief may be based on an underlying frequentist interpretation of similar cases and thus be rather objective. • A subjective belief interpretation: • The probability expresses our belief in a certain unobservable (or not yet observed) event. Slide 4 Department of Veterinary and Animal Sciences ”Experiments” An experiment may be anything creating an outcome we can observe. The sample space, S, is the set of all possible outcomes. An event, A, is a subset of S, i.e. A ⊆ S Two events A 1 and A 2 are called disjoint , if they have no common outcomes, i.e. if A 1 ∩ A 2 = ∅ Slide 5 Department of Veterinary and Animal Sciences Example of experiment Rolling a dice: • The sample space is S = {1, 2, 3, 4, 5, 6} • Examples of events: • A 1 = {1} • A 2 = {1, 5} • A 3 = {4, 5, 6} • Since A 1 ∩ A 3 = ∅ , A 1 and A 3 are disjoint. • A 1 and A 2 are not disjoint, because A 1 ∩ A 2 = {1} Slide 6 2
8/30/2018 Department of Veterinary and Animal Sciences A simplified definition Let S be the sample space of an experiment. A probability distribution P on S is a function, so that • P( S ) = 1. • For any event A ⊆ S, 0 ≤ P( A ) ≤ 1 • For any two disjoint events A 1 and A 2 , • P(A 1 ∪ A 2 ) = P(A 1 ) + P(A 2 ) Slide 7 Department of Veterinary and Animal Sciences Example: Rolling a dice Like before: S = {1, 2, 3, 4, 5, 6} A valid probability function on S is, for A ⊆ S : • P( A ) = | A |/6 where | A | is the size of A (i.e. the number of elements it contains) • P({1}) = P({2}) = P({3}) = P({4}) = P({5}) = P({6}) = 1/6 • P({1, 5}) = 2/6 = 1/3 • P({1, 2, 3}) = 3/6 = 1/2 Notice, that many other valid probability functions could be defined (even though the one above is the only one that makes sense from a frequentist point of view). Slide 8 Department of Veterinary and Animal Sciences Independence If two events A and B are independent, then • P( A ∩ B ) = P( A )P( B ). Example: Rolling two dices • S = {(1, 1), (1, 2),…, (1, 6),…, (6, 6)} • For any A ⊆ S : P( A ) = | A |/36 • A = {(6, 1), (6, 2), …, (6, 6)} ⇒ P( A ) = 6/36 = 1/6 • B = {(1, 6), (2, 6), …, (6, 6)} ⇒ P( B ) = 6/36 = 1/6 • A ∩ B = {(6, 6)} and P( A ∩ B) = (1/6)(1/6) = 1/36 Slide 9 3
8/30/2018 Department of Veterinary and Animal Sciences Conditional probabilities Let A and B be two events, where P( B ) > 0 The conditional probability of A given B is written as P( A | B ), and it is by definition Slide 10 Department of Veterinary and Animal Sciences Example: Rolling a dice Again, let S = {1, 2, 3, 4, 5, 6}, and P( A ) = | A |/6. Define B = {1, 2, 3}, and A = {2}. Then A ∩ B = {2}, and The logical result: If you know the outcome is 1, 2 or 3, it is reasonable to assume that all 3 values are equally probable. Slide 11 Department of Veterinary and Animal Sciences Conditional sum rule Let A 1 , A 2 , … A n be pair wise disjoint events so that Let B be an event so that P( B ) > 0. Then Slide 12 4
8/30/2018 Department of Veterinary and Animal Sciences Sum rule: Dice example Define the 3 disjoint events A 1 = {1, 2}, A 2 = {3, 4}, A 3 = {5, 6} Thus A 1 ∪ A 2 ∪ A 3 = S Define B = {1, 3, 5} (we know that P( B ) = ½) P( B | A 1 ) = P( B ∩ A 1 )/P( A 1 ) = (1/6)/(1/3) = ½ P( B | A 2 ) = P( B ∩ A 2 )/P( A 2 ) = (1/6)/(1/3) = ½ P( B | A 3 ) = P( B ∩ A 3 )/P( A 3 ) = (1/6)/(1/3) = ½ Thus Slide 13 Department of Veterinary and Animal Sciences Bayes’ theorem Let A 1 , A 2 , … A n be pair wise disjoint events so that Let B be an event so that P( B ) > 0. Then Bayes’ theorem is extremely important in all kinds of reasoning under uncertainty. Updating of belief. Slide 14 Department of Veterinary and Animal Sciences Updating of belief, I In a dairy herd, the conception rate is known to be 0.40. Define M as the event ”mating” for a cow. Define Π + as the event ”pregnant” for the same cow, and Π - as the event ”not pregnant”. Thus P( Π + | M ) = 0.40 is a conditional probability. Given that the cow has been mated, the probability of pregnancy is 0.40. Accordingly, P( Π - | M ) = 0.60 After 3 weeks the farmer observes the cow for heat. The farmer’s heat detection rate is 0.55. Define H + as the event that the farmer detects heat. Thus, P( H + | Π - ) = 0.55, and P( H - | Π - ) = 0.45 There is a slight risk that the farmer erroneously observes a pregnant cow to be in heat. We assume, that P( H + | Π + ) = 0.01 Notice, that all probabilities are figures that makes sense and are estimated on a routine basis (except P( H + | Π + ) which is a guess) Slide 15 5
8/30/2018 Department of Veterinary and Animal Sciences Updating of belief, II Now, let us assume that the farmer observes the cow, and concludes, that it is not in heat. Thus, we have observed the event H - and we would like to know the probability, that the cow is pregnant, i.e. we wish to calculate P( Π + | H - ) We apply Bayes’ theorem: We know all probabilities in the formula, and get In other words, our belief in the event ”pregnant” increases from 0.40 to 0.59 based on a negative heat observation result Slide 16 Department of Veterinary and Animal Sciences Summary of probabilities Probabilities may be interpreted • As frequencies • As objective or subjective beliefs in certain events The belief interpretation enables us to represent uncertain knowledge in a concise way. Bayes’ theorem lets us update our belief (knowledge) as new observations are done. Slide 17 Department of Veterinary and Animal Sciences Discrete distributions In some cases the probability is defined by a certain function defined over the sample space. In those cases, we say that the outcome is drawn from a standard distribution. There exist standard distributions for many natural phenomena. If the sample space is a countable set, we denote the corresponding distribution as discrete. Slide 18 6
8/30/2018 Department of Veterinary and Animal Sciences Discrete distributions If X is the random variable representing the outcome, the expected value of a discrete distribution is defined as The variance is defined as We shall look at two important discrete distributions: • The binomial distribution • The Poisson distribution. Slide 19 Department of Veterinary and Animal Sciences The binomial distribution I Consider an experiment with binary outcomes: Success (s) or failure (f) • Mating of a sow → Pregnant (s), not pregnant (f) • Tossing a coin → Heads (s), tails (f) • Testing for a disease → Present (s), not present (f) Assume that the probability of success is p and that the experiment is repeated n times. Let X be the total number of successes observed in the n experiments. The sample space of the compound n experiments is S = {0, 1, 2, …, n } The random variable X is then said to be binomially distributed with parameters p and n . Slide 20 Department of Veterinary and Animal Sciences The binomial distribution II The probability function P( X = k ) is (by objective frequentist interpretation) given by where is the binomial coefficient which may be calculated or looked up in a table. Slide 21 7
8/30/2018 Department of Veterinary and Animal Sciences The binomial distribution III The mean (expected value) of a binomial distribution is simply E( X ) = np . The variance is Var( X ) = np (1- p ) The binomial distribution is one of the most frequently used distribution for natural phenomena. Slide 22 The binomial distribution IV Three binomial distributions with n = 10 0,35 0,3 0,25 0,2 P( k ) 0,2 0,5 0,15 0,8 0,1 0,05 0 0 1 2 3 4 5 6 7 8 9 10 k Three binomial distributions, where n = 10, and p = 0.2, 0.5 and 0.8, respectively. Department of Veterinary and Animal Sciences The Poisson distribution I If a certain phenomenon occurs a random with a constant intensity (but independently of each others) the total number of occurrences X in a time interval of a given length (or in a space of a given area) is Poisson distributed with parameter λ Examples: • Number of (non-infectious) disease cases per month • Number of feeding system failures per year • Number of labor incidents per year Slide 24 8
Recommend
More recommend