Download Presentation
## Maximum Likelihood

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Maximum Likelihood**Benjamin Neale Boulder Workshop 2012**We will cover**• Easy introduction to probability • Rules of probability • How to calculate likelihood for discrete outcomes • Confidence intervals in likelihood • Likelihood for continuous data**Starting simple**• Let’s think about probability**Starting simple**• Let’s think about probability • Coin tosses • Winning the lottery • Roll of the die • Roulette wheel**Starting simple**• Let’s think about probability • Coin tosses • Winning the lottery • Roll of the die • Roulette wheel • Chance of an event occurring**Starting simple**• Let’s think about probability • Coin tosses • Winning the lottery • Roll of the die • Roulette wheel • Chance of an event occurring • Written as P(event) = probability of the event**Simple probability calculations**• To get comfortable with probability, let’s solve these problems: • Probability of rolling an even number on a six-sided die • Probability of pulling a club from a deck of cards**Simple probability calculations**• To get comfortable with probability, let’s solve these problems: • Probability of rolling an even number on a six-sided die ½ or 0.5 • Probability of pulling a club from a deck of cards ¼ or 0.25**Simple probability rules**• P(A and B) = P(A)*P(B)**Simple probability rules**• P(A and B) = P(A)*P(B) • E.g. what is the probability of tossing 2 heads in a row?**Simple probability rules**• P(A and B) = P(A)*P(B) • E.g. what is the probability of tossing 2 heads in a row? • A = Heads and B = Heads so,**Simple probability rules**• P(A and B) = P(A)*P(B) • E.g. what is the probability of tossing 2 heads in a row? • A = Heads and B = Heads so, • P(A) = ½, P(B) = ½,P(A and B) = ¼**Simple probability rules**• P(A and B) = P(A)*P(B) • E.g. what is the probability of tossing 2 heads in a row? • A = Heads and B = Heads so, • P(A) = ½, P(B) = ½, P(A and B) = ¼ *We assume independence**Simple probability rules cnt’d**• P(A or B) = P(A) + P(B) – P(A and B)**Simple probability rules cnt’d**• P(A or B) = P(A) + P(B) – P(A and B) • What is the probability of rolling a 1 or a 4?**Simple probability rules cnt’d**• P(A or B) = P(A) + P(B) – P(A and B) • What is the probability of rolling a 1 or a 4? • A = rolling a 1 and B = rolling a 4**Simple probability rules cnt’d**• P(A or B) = P(A) + P(B) – P(A and B) • What is the probability of rolling a 1 or a 4? • A = rolling a 1 and B = rolling a 4 • P(A) = , P(B) = , P(A or B) = 1 1 1 6 6 3**Simple probability rules cnt’d**• P(A or B) = P(A) + P(B) – P(A and B) • What is the probability of rolling a 1 or a 4? • A = rolling a 1 and B = rolling a 4 • P(A) = , P(B) = , P(A or B) = 1 1 1 6 6 3 *We assume independence**Recap of rules**• P(A and B) = P(A)*P(B) • P(A or B) = P(A) + P(B) – P(A and B) • Sometimes things are ‘exclusive’ such as rolling a 6 and rolling a 4. It cannot occur in the same trial implies P(A and B) = 0 Assuming independence**Conditional probabilities**• P(X | Y) = the probability of X occurring given Y.**Conditional probabilities**• P(X | Y) = the probability of X occurring given Y. • Y can be another event (perhaps that predicts X)**Conditional probabilities**• P(X | Y) = the probability of X occurring given Y. • Y can be another event (perhaps that predicts X) • Y can be a probability or set of probabilities**Conditional probabilities**• Roll two dice in succession**1**12 Conditional probabilities • Roll two dice in succession • P(total = 10) =**1**12 Conditional probabilities • Roll two dice in succession • P(total = 10) = • What is P(total = 10 | 1st die = 5)?**1**1 12 6 Conditional probabilities • Roll two dice in succession • P(total = 10) = • What is P(total = 10 | 1st die = 5)? • P(total = 10 | 1st die = 5) =**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome:**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome:**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome: Probability # of k results # of trials**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome: Number of combinations of n choose k ! = factorial; n! = n*(n-1)*(n-2)*…*2*1 and factorials are bad for big numbers**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome: Probability of not k occurring Probability of k occurring**Binomial probabilities**• Used for two conditions such as coin toss • Determine the chance of any outcome: Probability of not k occurring Number of combinations of n choose k Probability # of positive results Probability of k occurring # of trials ! = factorial; n! = n*(n-1)*(n-2)*…*2*1 and factorials are bad for big numbers**Combinations piece long way**• Does it work? Let’s try: How many combinations for 3 heads out of 5 tosses?**Combinations piece long way**• Does it work? Let’s try: How many combinations for 3 heads out of 5 tosses? • HHHTT, HHTHT, HHTTH, HTHHT, HTHTH, HTTHH, THHHT, THHTH, THTHH, TTHHH = 10 possible combinations**Combinations piece formula**• Does it work? Let’s try: How many combinations for 3 heads out of 5 tosses? • We have 5 choose 3 = 5!/(3!)*(2!) • =(5*4)/2 • =10**Probability roundup**• We assumed the ‘true’ parameter values • E.g. P(Heads) = P(Tails) = ½**Probability roundup**• We assumed the ‘true’ parameter values • E.g. P(Heads) = P(Tails) = ½ • What happens if we have data and want to determine the parameter values?**Probability roundup**• We assumed the ‘true’ parameter values • E.g. P(Heads) = P(Tails) = ½ • What happens if we have data and want to determine the parameter values? • Likelihood works the other way round: what is the probability of the observed data given parameter values?**Concrete example**• Likelihood aims to calculate the range of probabilities for observed data, assuming different parameter values.**Concrete example**• Likelihood aims to calculate the range of probabilities for observed data, assuming different parameter values. • The set of probabilities is referred to as a likelihood surface**Concrete example**• Likelihood aims to calculate the range of probabilities for observed data, assuming different parameter values. • The set of probabilities is referred to as a likelihood surface • We’re going to generate the likelihood surface for a coin tossing experiment**Concrete example**• Likelihood aims to calculate the range of probabilities for observed data, assuming different parameter values. • The set of probabilities is referred to as a likelihood surface • We’re going to generate the likelihood surface for a coin tossing experiment • The set of parameter values with the best probability is the maximum likelihood**Coin tossing**• I tossed a coin 10 times and get 4 heads and 6 tails**Coin tossing**• I tossed a coin 10 times and get 4 heads and 6 tails • From this data, what does likelihood estimate the chance of heads and tails for this coin?**Coin tossing**• I tossed a coin 10 times and get 4 heads and 6 tails • From this data, what does likelihood estimate the chance of heads and tails for this coin? • We’re going to calculate: • P(4 heads out of 10 tosses| P(H) = *) • where star takes on a range of values**Calculations**• P(4 heads out of 10 tosses | P(H)=0.1) = We can make this easier, as it will be constant C* across all calculations**Calculations**• P(4 heads out of 10 tosses | P(H)=0.1) = Now all we do is change the values of p and q**Calculations**• P(4 heads out of 10 tosses | P(H)=0.1) =**Table of likelihoods**Largest probability observed = maximum likelihood