Course Overview: - Tuesday Lecture - Thursday Computer Lab
Course Overview: - Tuesday Lecture - Thursday Computer Lab
Tuesdaylecture
Thosenotpresentingturninshortreviewofa
paperusingthemethodbeingdiscussed
Thursdaycomputerlab
Turninshortwriteupfrompreviouscomputer
lab.
Somemethodstakesomecomputationaltime,
sobringsomethingelsealong.
MaximumLikelihood,MCMC,
andBayesTheorem
PopQuiz
MaximumLikelihood,MCMC,
andBayesTheorem
Maximum likelihood
methods find the parameters
most likely to produce the
data observed given a
specific model.
Maximum likelihood
methods find the parameters
most likely to produce the
data observed given a
specific model.
Thelikelihood(L)istheprobabilityofthedatagiven
thehypothesis(orparametervalue).
L=P(data|hypothesis)
WewilluseMLforvarietyof
calculations
WhatistheMLestimateofdN/dSfora
codonalignment?
Whatparametersoptimizeconservedversus
neutralregions?
Whatnumberofpopulationsmaximizesthe
likelihood?
Whatismaximumlikelihood?
Comparisontoprobabilitytheory:
Probability of # heads in 5 coin tosses
Heads
0
1
2
3
4
5
Prob.
.03
.16
.31
.31
.16
.03
P(x) = (n!/(n-x)!)pxqn-x
Samecalculationforcoinswithdifferentbias.
Bias
.1
.59
.33
.07
.01
.00
.00
Heads
0
1
2
3
4
5
Samecalculationforcoinswithdifferentbias.
Samecalculationforcoinswithdifferentbias.
Observe1headin5cointosses,whatisthe
Maximumlikelihoodestimateforcoinbias?
Bias of coin towards Heads
Wantto
Heads
.1 .3
.5 .7
.9
determine
0
.59 .17 .03 .00 .00
biasfrom
1
.33 .36 .16 .03 .00
observed
2
.07 .31 .31 .13 .01
#heads
3
.01 .13 .31 .31 .07
4
.00 .03 .16 .36 .33
5
.00 .00 .03 .17 .59
Probabilitiessumto1
Thelikelihood(L)istheprobabilityofthedatagiven
thehypothesis(orparametervalue).
L=P(data|hypothesis)
Samecalculationforcoinswithdifferentbias.
Heads
0
1
2
3
4
5
Bias
.1
.59
.33
.07
.01
.00
.00
Likelihoodsdonotsumto1.Maximumisparameterthat
bestfitstheobserveddata.
Thelikelihood(L)istheprobabilityofthedatagiven
thehypothesis(orparametervalue).
L=P(data|hypothesis)
Samecalculationforcoinswithdifferentbias.
Bias
.1
.59
.33
.07
.01
.00
.00
Heads
0
1
2
3
4
5
Likelihoodsusuallyrepresentedasln(L),
Solookingforleastnegativevalue.
Ln(0.33)=1.1
ln(0.36)=1.02
Ln(0.16)=1.8
Oneuseofmaximumlikelihoodforphylogenyinference.
Thelikelihood(L)ofatreeistheprobabilityofthedatagiven
thetreeandmodel(hypothesisorparametervalue).
L=P(data|tree)
ProblemisthatthereareLOTSofpossibletrees(hypotheses).
Howdowecalculate/estimate
likelihoods?
Onewaytogetthelikelihoodisto
estimatethem
usingMarkovChainMonteCarlo
(MCMC)methods.
analogytowalkinguphill.
Likelihood
Parameterestimationismadebychangingvalues,
estimatinglikelihood,andrepeatinguntilthe
functionhasbeenmaximized.
Parameterestimate
GraphsfromJohnHuelsenbeck
MarkovChainMonteCarlo
Startwithproposedstate
Perturboldstateandcalculateprobabilityofnew
state
Testifnewstateisbetterthanoldstate,acceptif
ratioofnewtooldisgreaterthanarandomly
drawnnumberbetween0and1.
Movetonewstateifaccepted,ifnotstayatold
state
Startover
MarkovChainMonteCarlo
Startwithproposedstate
Perturboldstateandcalculateprobabilityofnew
state
Testifnewstateisbetterthanoldstate,acceptif
ratioofnewtooldisgreaterthanarandomly
drawnnumberbetween0and1.
Movetonewstateifaccepted,ifnotstayatold
state
Startover
MarkovChainMonteCarlo
Startwithproposedstate
Perturboldstateandcalculateprobabilityofnew
state
Testifnewstateisbetterthanoldstate,acceptif
ratioofnewtooldisgreaterthanarandomly
drawnnumberbetween0and1.
Movetonewstateifaccepted,ifnotstayatold
state
Startover
MarkovChainMonteCarlo
Startwithproposedstate
Perturboldstateandcalculateprobabilityofnew
state
Testifnewstateisbetterthanoldstate,acceptif
ratioofnewtooldisgreaterthanarandomly
drawnnumberbetween0and1.
Movetonewstateifaccepted,ifnotstayatold
state
Startover
MarkovChainMonteCarlo
Startwithproposedstate
Perturboldstateandcalculateprobabilityofnew
state
Testifnewstateisbetterthanoldstate,acceptif
ratioofnewtooldisgreaterthanarandomly
drawnnumberbetween0and1.
Movetonewstateifaccepted,ifnotstayatold
state
Startover
Circlerepresentsamountofpotentialproposedchange.
Repeatstepsuntilyoufindthepeak.
Whatistheanswer
Peak=maximumlikelihood
Mean
Mode
Median
Credibleset(iewithconfidenceinterval)
Howdoyouknowifyoureached
thepeak(maximumlikelihood)?
Convergence=testedalloflikelihoodsurfaceandfound
maximum
examplewhichdidnotconverge(chaincaughtinlocaloptima)
Convergence=testedalloflikelihoodsurfaceandfoundmaximum
Checkconvergenceby
startingdifferentinitialestimates
increasetheamountvaluesalteredforparameteroptimization
reruntheanalysisseveraltimes
runforverylongtime
MCRobotdemo:
Anyothermethodstoexploreparameterspace?
Heatedchains
Heatingreferstopoweringtheacceptance
rejectionformula(newheight/oldheight).
Ifgreaterthan1,alwaysaccept
If<1andcoldchainacceptwithp=0.25,
twiceashotchainwouldacceptwithp1/2=0.5
Coldchain
HotChainnoticepeakslower
Swapbetweenchains
MCRobotdemo
Nowwhattodowithlikelihoods
Comparemodels
Likelihoodratiotest(LRT)
IsthedN/dSratioforgeneAsignificantly
differentfrom1?
Doesaselectionmodelfitbetterthana
neutralmodel
Computeposteriorprobabilities
BayesTheorem
Determineconfidence
Comparetwonestedmodels
(LRT)
Foreachadditionalparameteradded,the
likelihoodshouldalwaysimprove
Howdoyoudetermineifimprovementis
significant?
Comparetwonestedmodels
Freeestimate(H1).EstimateofdN/dS()fromalignment.
1parameterestimated
lnL=100
Nullmodel(H0).FixdN/dS()tobe1.
0parametersestimated(allfixed)
lnL=90
Comparetwonestedmodels
Freeestimate(H1).EstimateofdN/dS()fromalignment.
1parameterestimated
lnL=100
Nullmodel(H0).FixdN/dS()tobe1.
0parametersestimated(allfixed)
lnL=90
LRTstatisticis2[lnL(H1)lnL(H0)]
Degreesoffreedom=difference#parameters
Compareto2distribution
Chisquaretable:
Significancelevel
DF0.99500.97500.90000.50000.10000.05000.01000.0010
10.00000.00100.01580.45492.70553.84156.634910.8276
20.01000.05060.21071.38634.60525.99159.210313.8155
30.07170.21580.58442.36606.25147.814711.344916.2662
40.20700.48441.06363.35677.77949.487713.276718.4668
50.41170.83121.61034.35159.236411.070515.086320.5150
Isitreallysosimple?
M7istheNullmodel(H0).
M8isthealternate(H1)
With2additionalparameters
Whatotherinformationcanyou
getfromMCMCmethods?
Bayesstheoremandposteriorprobability:
ExamplefromBox3,Lewis2001
UrnAcontains40%blackmarbles
UrnBcontains80%blackmarbles
Whatisthelikelihoodthatablackmarblecamefrom
UrnA?UrnB?
Whatistheposteriorprobabilitythatablackmarble
camefromUrnA?UrnB?
Asswithlikelihoods,thisisdifficulttocalculate.
CanweuseMCMC?
Foranappropriatelyconstructed
andadequatelyrunMarkov
chain,theproportionofthetime
anyparametervalueisvisitedisa
validapproximationofthe
posteriorprobabilityofthat
parameter(=Bayes)
lnL
Reddots=burninperiod.
generations
Reddots=burninperiod.
lnL
Burninperiod
generations
AdvantagesBayesianperspective
Givesprobabilityofhypothesisofinterest
Likelihoodprobabilitydatagivenhypothesis
Comparetobootstrap
Disadvantageissubjectivityofprior
TwotypeofBayesinferencewe
willsee
NaveEmpiricalBayes(NEB)
Assumesparameterestimatesfromlikelihood
areexact
BayesEmpiricalBayes(BEB)
Takesintoaccounterrorinlikelihoodestimates
ofparameters
Somethingstoconsiderwhen
runningMCMCanalyses
Numberofgenerations
Numberofchains
Burninperiod
Convergence
SomeusesofMCMC
Phylogeny
Modelsofcodonevolution(PAMLApril6)
Conservedregions(ShadowingApril13)
Mutationrates
Migrationrates
Populationstructure(StructureApril20)