lecture 4: maximum likelihood - boston universitypeople.bu.edu/dietze/bayes2020/lesson04_mle.pdf ·...

25
Lecture 4: Maximum Likelihood

Upload: others

Post on 27-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Lecture 4:Maximum Likelihood

Page 2: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Review – Common Distributions

● Uniform● Normal● Lognormal● Beta● Exponental/Laplace● Gamma

● Binomial● Bernoulli● Poisson● Negative Binomial● Geometric

Continuous Discrete

Page 3: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

What are we trying to do?

● “Confronting models with data”● How is the data modeled?

– What type of data?

– What process generated this data?

– What distributions are anappropriate descriptionof the data?

● How is the process modeled?● How are the parameters

modeled?

Page 4: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Why are we trying to do this?

● Quantify states & relationships– What is Y?

– How is Y related to X?

● Test Hypotheses● Prediction● Decision making

Page 5: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

How do we do this?

Page 6: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

0.16

0.06

Page 7: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Likelihood

● Probability of observing a given data point xconditional on parameter value q

● Likelihood principle: a parameter value is morelikely than another if it is the one for which thedata are more probable

L=P X=x∣=P data∣model

Page 8: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Maximum Likelihood

● Step 1: Construct Likelihood● Step 2: Maximize function

● Take Log of likelihood function● Take derivative of function● Set derivative = 0● Solve for parameter

L=P X=x∣=P data∣model

Goal: Find the q that maximizes L

Page 9: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Example – Mortality Rate

● Assume mortality rate is constant – r – but is anUNKNOWN we want to estimate

● ai is a KNOWN time of death

Pr aaia a = Pr die now given that

plant is still alive ⋅Pr plant is

still alive≈ a × e−a

= Expa∣ a

Page 10: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

L=Pr a∣∝Exp a∣

Page 11: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

An Observation● A plant is observed to die on day 10

● From this observation, what is the best estimate for r?

Page 12: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

A few things to note

● A likelihood surface is NOT a PDF

● Pr(X | q) ≠ Pr(q | X)● Does not integrate to 1● No, you can't just normalize it● The model parameter is being varied, not the

random variable– i.e. the x-axis is fixed, not random

● Cannot interpret surface in terms of it's mean,variance, quantiles

Page 13: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

Maximum Likelihood

● Step 1: Write a likelihood function describingthe likelihood of the observation

● Step 2: Find the value of the model parameterthat maximized the likelihood

dLd

=0

Page 14: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

L = e−a

ln L = ln −a

∂ ln L∂

= 1−a=0

ML = 1a

= 0.1day−1

Page 15: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

L = e−a

ln L = ln −a

∂ ln L∂

= 1−a=0

ML = 1a

= 0.1day−1

ln e−aln ln e−aln −a

Page 16: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

L = e−a

ln L = ln −a

∂ ln L∂

= 1−a=0

ML = 1a

= 0.1day−1

∂[ ln −a]∂

∂ ln ∂

−∂a∂

1−a

Page 17: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

L = e−a

ln L = ln −a

∂ ln L∂

= 1−a=0

ML = 1a

= 0.1day−1

1=a

1=a1a=

a = 10

Page 18: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal
Page 19: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

● Suppose a second plant dies at day 14● Step 1: Define the likelihood

A second data point

L = Pr (a1,a2∣ρ)

= Pr (a2∣a1,ρ)Pr (a1∣ρ)

= Pr (a2∣ρ)Pr (a1∣ρ)

∝ Exp(a2∣ρ)Exp(a1∣ρ)

Assume measurements areindependent

Page 20: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

● Step 2: Find the maximum

L = e−a1⋅e−a2

ln L = 2 ln −a1−a2

∂ ln L∂

= 2−a1a2=0

ML = 2a1a2

= 0.0833day−1

Page 21: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal
Page 22: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal
Page 23: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

A whole data set

● Step 1: Define Likelihood

L = Pr a1,a2,⋯, an∣

= ∏i=1

n

Pr ai∣

= ∏i=1

n

Exp ai∣

Assume measurements areindependent

Page 24: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal

● Step 2: Find the maximum

L = ∏i=1

n

e− ai

ln L = ∑i=1

n

ln−ai

= n ln−∑i=1

n

ai

∂ ln L∂

= n−∑i=1

n

ai=0

ML = n

∑i=1

n

ai

= 1/a

Page 25: Lecture 4: Maximum Likelihood - Boston Universitypeople.bu.edu/dietze/Bayes2020/Lesson04_MLE.pdf · Lecture 4: Maximum Likelihood. Review – Common Distributions Uniform Normal Lognormal