SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Bayesian Case Studies, week 2

          Robin J. Ryder


         14 January 2013




      Robin J. Ryder   Bayesian Case Studies, week 2
Reminder: Poisson model, Conjugate Gamma prior




  For the Poisson model Yi ∼ Poisson(λ) with a Γ(a, b) prior on λ,
  the posterior is
                                          n
                    π(λ|Y ) ∼ Γ(a +            yi , b + n)
                                           1




                        Robin J. Ryder   Bayesian Case Studies, week 2
Model choice



  We have an extra binary variable Zi . We would like to check
  whether Yi depends on Zi , and therefore need to choose between
  two models:
                  M1                                  M2
                                           Yi |Zi = k ∼i.i.d            P(λk )
          Yi   ∼i.i.d    P(λ)
                                               λ1     ∼                 Γ(a, b)
          λ    ∼        Γ(a, b)
                                               λ2     ∼                 Γ(a, b)




                          Robin J. Ryder      Bayesian Case Studies, week 2
The model index is a parameter



  We now consider an extra parameter M ∈ {1, 2} which indicates
  the model index. We can put a prior on M, for example a uniform
  prior: P[M = k] = 1/2. Inside model k, we note the parameters
  θk and the prior on θk is noted πk .
  We are then interested in the posterior distribution

           P[M = k|y ] ∝ P[M = k]            L(θk |y )πk (θk )dθk




                       Robin J. Ryder   Bayesian Case Studies, week 2
Bayes factor


  The evidence for or against a model given data is summarized in
  the Bayes factor:

                              P[M = 2|y ]/P[M = 1|y ]
               B21 (y ) =                             ]
                               P[M = 2]/P[M = 1]
                              m2 (y )
                        =
                              m1 (y )
                where
               mk (y ) =             L(θk |y )πk (θk )dθk
                                Θk




                        Robin J. Ryder    Bayesian Case Studies, week 2
Bayes factor




  Note that the quantity

                   mk (y ) =             L(θk |y )πk (θk )dθk
                                    Θk

  corresponds to the normalizing constant of the posterior when we
  write
                      π(θk |y ) ∝ L(θk |y )πk (θk )




                           Robin J. Ryder    Bayesian Case Studies, week 2
Interpreting the Bayes factor




  Jeffrey’s scale of evidenc states that
      If log10 (B21 ) is between 0 and 0.5, then the evidence in favor
      of model 2 is weak
      between 0.5 and 1, it is substantial
      between 1 and 2, it is strong
      above 2, it is decisive
  (and symmetrically for negative values)




                         Robin J. Ryder   Bayesian Case Studies, week 2
Analytical value



  Remember that        ∞
                                              Γ(a)
                           λa−1 e −bλ dλ =
                   0                           ba




                   Robin J. Ryder   Bayesian Case Studies, week 2
Analytical value



  Remember that             ∞
                                                    Γ(a)
                                λa−1 e −bλ dλ =
                        0                            ba
  Thus
                                    b a Γ(a + yi )
                      m1 (y ) =
                                   Γ(a) (b + n)a+ yi
  and
                       b 2a Γ(a + yiH ) Γ(a + yiF )
          m2 (y ) =
                      Γ(a)2 (b + nH )a+ yiH (b + nF )a+ yiF




                         Robin J. Ryder   Bayesian Case Studies, week 2
Monte Carlo



  Let
                           I=          h(x)g (x)dx

  where g is a density. Then take x1 , . . . , xN iid from g and we have

                           ˆ     1
                           IMC =
                             N                 h(xi )
                                 N
  which converges (almost surely) to I.
  When implementing this, you need to check convergence!




                          Robin J. Ryder   Bayesian Case Studies, week 2
Harmonic mean estimator


  Take a sample from the posterior distribution π1 (θ1 |y ). Note that

                    1                              1
          Eπ 1             |y        =                  π1 (θ1 |y )dθ1
                 L(θ1 |y )                    L(θ1 |y )
                                                   1    π1 (θ1 )L(θ1 |y )
                                     =                                    dθ1
                                              L(θ1 |y )      m1 (y )
                                              1
                                     =
                                            m1 (y )

  thus giving an easy way to estimate m1 (y ) by Monte Carlo.
  However, this method is in general not advised, since the
  associated estimator has infinite variance.




                                Robin J. Ryder   Bayesian Case Studies, week 2
Importance sampling



                           I=          h(x)g (x)dx

  If we wish to perform Monte Carlo but cannot easily sample from
  g , we can re-write

                                   h(x)g (x)
                        I=                   γ(x)dx
                                     γ(x)

  where γ is easy to sample from. Then take x1 , . . . , xN iid from γ
  and we have
                       ˆ      1    h(xi )g (xi )
                       IIS =
                         N
                              N       γ(xi )




                          Robin J. Ryder   Bayesian Case Studies, week 2

Más contenido relacionado

La actualidad más candente

Modular representation theory of finite groups
Modular representation theory of finite groupsModular representation theory of finite groups
Modular representation theory of finite groupsSpringer
 
Lattices of Lie groups acting on the complex projective space
Lattices of Lie groups acting on the complex projective spaceLattices of Lie groups acting on the complex projective space
Lattices of Lie groups acting on the complex projective spaceRene García
 
Signal Processing Course : Sparse Regularization of Inverse Problems
Signal Processing Course : Sparse Regularization of Inverse ProblemsSignal Processing Course : Sparse Regularization of Inverse Problems
Signal Processing Course : Sparse Regularization of Inverse ProblemsGabriel Peyré
 
Principal component analysis and matrix factorizations for learning (part 2) ...
Principal component analysis and matrix factorizations for learning (part 2) ...Principal component analysis and matrix factorizations for learning (part 2) ...
Principal component analysis and matrix factorizations for learning (part 2) ...zukun
 
Comparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsComparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsBigMC
 
Supplement to local voatility
Supplement to local voatilitySupplement to local voatility
Supplement to local voatilityIlya Gikhman
 
Computation of the marginal likelihood
Computation of the marginal likelihoodComputation of the marginal likelihood
Computation of the marginal likelihoodBigMC
 
Csr2011 june16 12_00_wagner
Csr2011 june16 12_00_wagnerCsr2011 june16 12_00_wagner
Csr2011 june16 12_00_wagnerCSR2011
 
An introduction to quantum stochastic calculus
An introduction to quantum stochastic calculusAn introduction to quantum stochastic calculus
An introduction to quantum stochastic calculusSpringer
 
Gentle Introduction to Dirichlet Processes
Gentle Introduction to Dirichlet ProcessesGentle Introduction to Dirichlet Processes
Gentle Introduction to Dirichlet ProcessesYap Wooi Hen
 
Matrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsMatrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsUtrecht University
 
On Convolution of Graph Signals and Deep Learning on Graph Domains
On Convolution of Graph Signals and Deep Learning on Graph DomainsOn Convolution of Graph Signals and Deep Learning on Graph Domains
On Convolution of Graph Signals and Deep Learning on Graph DomainsJean-Charles Vialatte
 
Montpellier Math Colloquium
Montpellier Math ColloquiumMontpellier Math Colloquium
Montpellier Math ColloquiumChristian Robert
 
Practical computation of Hecke operators
Practical computation of Hecke operatorsPractical computation of Hecke operators
Practical computation of Hecke operatorsMathieu Dutour Sikiric
 

La actualidad más candente (19)

Modular representation theory of finite groups
Modular representation theory of finite groupsModular representation theory of finite groups
Modular representation theory of finite groups
 
Lattices of Lie groups acting on the complex projective space
Lattices of Lie groups acting on the complex projective spaceLattices of Lie groups acting on the complex projective space
Lattices of Lie groups acting on the complex projective space
 
Signal Processing Course : Sparse Regularization of Inverse Problems
Signal Processing Course : Sparse Regularization of Inverse ProblemsSignal Processing Course : Sparse Regularization of Inverse Problems
Signal Processing Course : Sparse Regularization of Inverse Problems
 
Principal component analysis and matrix factorizations for learning (part 2) ...
Principal component analysis and matrix factorizations for learning (part 2) ...Principal component analysis and matrix factorizations for learning (part 2) ...
Principal component analysis and matrix factorizations for learning (part 2) ...
 
Integration
IntegrationIntegration
Integration
 
Comparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsComparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering models
 
Supplement to local voatility
Supplement to local voatilitySupplement to local voatility
Supplement to local voatility
 
Computation of the marginal likelihood
Computation of the marginal likelihoodComputation of the marginal likelihood
Computation of the marginal likelihood
 
Log char
Log charLog char
Log char
 
Lesson 6 1
Lesson 6 1Lesson 6 1
Lesson 6 1
 
Csr2011 june16 12_00_wagner
Csr2011 june16 12_00_wagnerCsr2011 june16 12_00_wagner
Csr2011 june16 12_00_wagner
 
An introduction to quantum stochastic calculus
An introduction to quantum stochastic calculusAn introduction to quantum stochastic calculus
An introduction to quantum stochastic calculus
 
Gentle Introduction to Dirichlet Processes
Gentle Introduction to Dirichlet ProcessesGentle Introduction to Dirichlet Processes
Gentle Introduction to Dirichlet Processes
 
Igv2008
Igv2008Igv2008
Igv2008
 
Matrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsMatrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial Backgrounds
 
On Convolution of Graph Signals and Deep Learning on Graph Domains
On Convolution of Graph Signals and Deep Learning on Graph DomainsOn Convolution of Graph Signals and Deep Learning on Graph Domains
On Convolution of Graph Signals and Deep Learning on Graph Domains
 
Montpellier Math Colloquium
Montpellier Math ColloquiumMontpellier Math Colloquium
Montpellier Math Colloquium
 
Practical computation of Hecke operators
Practical computation of Hecke operatorsPractical computation of Hecke operators
Practical computation of Hecke operators
 
Lista exercintegrais
Lista exercintegraisLista exercintegrais
Lista exercintegrais
 

Similar a Bayesian case studies, practical 2

A new class of a stable implicit schemes for treatment of stiff
A new class of a stable implicit schemes for treatment of stiffA new class of a stable implicit schemes for treatment of stiff
A new class of a stable implicit schemes for treatment of stiffAlexander Decker
 
Physics of Algorithms Talk
Physics of Algorithms TalkPhysics of Algorithms Talk
Physics of Algorithms Talkjasonj383
 
Application of matrix algebra to multivariate data using standardize scores
Application of matrix algebra to multivariate data using standardize scoresApplication of matrix algebra to multivariate data using standardize scores
Application of matrix algebra to multivariate data using standardize scoresAlexander Decker
 
11.application of matrix algebra to multivariate data using standardize scores
11.application of matrix algebra to multivariate data using standardize scores11.application of matrix algebra to multivariate data using standardize scores
11.application of matrix algebra to multivariate data using standardize scoresAlexander Decker
 
Multiple integrals
Multiple integralsMultiple integrals
Multiple integralsTarun Gehlot
 
Multiple integrals
Multiple integralsMultiple integrals
Multiple integralsTarun Gehlot
 
Fuzzy directed divergence and image segmentation
Fuzzy directed divergence and image segmentationFuzzy directed divergence and image segmentation
Fuzzy directed divergence and image segmentationSurender Singh
 
04 structured prediction and energy minimization part 1
04 structured prediction and energy minimization part 104 structured prediction and energy minimization part 1
04 structured prediction and energy minimization part 1zukun
 
01 graphical models
01 graphical models01 graphical models
01 graphical modelszukun
 
Fractional hot deck imputation - Jae Kim
Fractional hot deck imputation - Jae KimFractional hot deck imputation - Jae Kim
Fractional hot deck imputation - Jae KimJae-kwang Kim
 
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorDual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorSebastian De Haro
 
Bayesian regression models and treed Gaussian process models
Bayesian regression models and treed Gaussian process modelsBayesian regression models and treed Gaussian process models
Bayesian regression models and treed Gaussian process modelsTommaso Rigon
 
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...SEENET-MTP
 

Similar a Bayesian case studies, practical 2 (20)

Lagrange
LagrangeLagrange
Lagrange
 
Holographic Cotton Tensor
Holographic Cotton TensorHolographic Cotton Tensor
Holographic Cotton Tensor
 
A new class of a stable implicit schemes for treatment of stiff
A new class of a stable implicit schemes for treatment of stiffA new class of a stable implicit schemes for treatment of stiff
A new class of a stable implicit schemes for treatment of stiff
 
Physics of Algorithms Talk
Physics of Algorithms TalkPhysics of Algorithms Talk
Physics of Algorithms Talk
 
YSC 2013
YSC 2013YSC 2013
YSC 2013
 
Application of matrix algebra to multivariate data using standardize scores
Application of matrix algebra to multivariate data using standardize scoresApplication of matrix algebra to multivariate data using standardize scores
Application of matrix algebra to multivariate data using standardize scores
 
11.application of matrix algebra to multivariate data using standardize scores
11.application of matrix algebra to multivariate data using standardize scores11.application of matrix algebra to multivariate data using standardize scores
11.application of matrix algebra to multivariate data using standardize scores
 
Multiple integrals
Multiple integralsMultiple integrals
Multiple integrals
 
Multiple integrals
Multiple integralsMultiple integrals
Multiple integrals
 
Fuzzy directed divergence and image segmentation
Fuzzy directed divergence and image segmentationFuzzy directed divergence and image segmentation
Fuzzy directed divergence and image segmentation
 
04 structured prediction and energy minimization part 1
04 structured prediction and energy minimization part 104 structured prediction and energy minimization part 1
04 structured prediction and energy minimization part 1
 
01 graphical models
01 graphical models01 graphical models
01 graphical models
 
Fractional hot deck imputation - Jae Kim
Fractional hot deck imputation - Jae KimFractional hot deck imputation - Jae Kim
Fractional hot deck imputation - Jae Kim
 
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorDual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
 
Bayesian regression models and treed Gaussian process models
Bayesian regression models and treed Gaussian process modelsBayesian regression models and treed Gaussian process models
Bayesian regression models and treed Gaussian process models
 
www.ijerd.com
www.ijerd.comwww.ijerd.com
www.ijerd.com
 
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...
M. Visinescu - Higher Order First Integrals, Killing Tensors, Killing-Maxwell...
 
1 cb02e45d01
1 cb02e45d011 cb02e45d01
1 cb02e45d01
 
Gz3113501354
Gz3113501354Gz3113501354
Gz3113501354
 
Gz3113501354
Gz3113501354Gz3113501354
Gz3113501354
 

Más de Robin Ryder

Bayesian Methods for Historical Linguistics
Bayesian Methods for Historical LinguisticsBayesian Methods for Historical Linguistics
Bayesian Methods for Historical LinguisticsRobin Ryder
 
A phylogenetic model of language diversification
A phylogenetic model of language diversificationA phylogenetic model of language diversification
A phylogenetic model of language diversificationRobin Ryder
 
Statistical Methods in Historical Linguistics
Statistical Methods in Historical LinguisticsStatistical Methods in Historical Linguistics
Statistical Methods in Historical LinguisticsRobin Ryder
 
Introduction à ABC
Introduction à ABCIntroduction à ABC
Introduction à ABCRobin Ryder
 
On the convergence properties of the Wang-Landau algorithm
On the convergence properties of the Wang-Landau algorithmOn the convergence properties of the Wang-Landau algorithm
On the convergence properties of the Wang-Landau algorithmRobin Ryder
 
Bayesian case studies, practical 1
Bayesian case studies, practical 1Bayesian case studies, practical 1
Bayesian case studies, practical 1Robin Ryder
 
Modèles phylogéniques de la diversification des langues
Modèles phylogéniques de la diversification des languesModèles phylogéniques de la diversification des langues
Modèles phylogéniques de la diversification des languesRobin Ryder
 
Talk at Institut Jean Nicod on 6 October 2010
Talk at Institut Jean Nicod on 6 October 2010Talk at Institut Jean Nicod on 6 October 2010
Talk at Institut Jean Nicod on 6 October 2010Robin Ryder
 
Phylogenetic models and MCMC methods for the reconstruction of language history
Phylogenetic models and MCMC methods for the reconstruction of language historyPhylogenetic models and MCMC methods for the reconstruction of language history
Phylogenetic models and MCMC methods for the reconstruction of language historyRobin Ryder
 
Modèles phylogénétiques de la diversification des langues
Modèles phylogénétiques de la diversification des languesModèles phylogénétiques de la diversification des langues
Modèles phylogénétiques de la diversification des languesRobin Ryder
 
Approximate Bayesian Computation (ABC)
Approximate Bayesian Computation (ABC)Approximate Bayesian Computation (ABC)
Approximate Bayesian Computation (ABC)Robin Ryder
 

Más de Robin Ryder (11)

Bayesian Methods for Historical Linguistics
Bayesian Methods for Historical LinguisticsBayesian Methods for Historical Linguistics
Bayesian Methods for Historical Linguistics
 
A phylogenetic model of language diversification
A phylogenetic model of language diversificationA phylogenetic model of language diversification
A phylogenetic model of language diversification
 
Statistical Methods in Historical Linguistics
Statistical Methods in Historical LinguisticsStatistical Methods in Historical Linguistics
Statistical Methods in Historical Linguistics
 
Introduction à ABC
Introduction à ABCIntroduction à ABC
Introduction à ABC
 
On the convergence properties of the Wang-Landau algorithm
On the convergence properties of the Wang-Landau algorithmOn the convergence properties of the Wang-Landau algorithm
On the convergence properties of the Wang-Landau algorithm
 
Bayesian case studies, practical 1
Bayesian case studies, practical 1Bayesian case studies, practical 1
Bayesian case studies, practical 1
 
Modèles phylogéniques de la diversification des langues
Modèles phylogéniques de la diversification des languesModèles phylogéniques de la diversification des langues
Modèles phylogéniques de la diversification des langues
 
Talk at Institut Jean Nicod on 6 October 2010
Talk at Institut Jean Nicod on 6 October 2010Talk at Institut Jean Nicod on 6 October 2010
Talk at Institut Jean Nicod on 6 October 2010
 
Phylogenetic models and MCMC methods for the reconstruction of language history
Phylogenetic models and MCMC methods for the reconstruction of language historyPhylogenetic models and MCMC methods for the reconstruction of language history
Phylogenetic models and MCMC methods for the reconstruction of language history
 
Modèles phylogénétiques de la diversification des langues
Modèles phylogénétiques de la diversification des languesModèles phylogénétiques de la diversification des langues
Modèles phylogénétiques de la diversification des langues
 
Approximate Bayesian Computation (ABC)
Approximate Bayesian Computation (ABC)Approximate Bayesian Computation (ABC)
Approximate Bayesian Computation (ABC)
 

Bayesian case studies, practical 2

  • 1. Bayesian Case Studies, week 2 Robin J. Ryder 14 January 2013 Robin J. Ryder Bayesian Case Studies, week 2
  • 2. Reminder: Poisson model, Conjugate Gamma prior For the Poisson model Yi ∼ Poisson(λ) with a Γ(a, b) prior on λ, the posterior is n π(λ|Y ) ∼ Γ(a + yi , b + n) 1 Robin J. Ryder Bayesian Case Studies, week 2
  • 3. Model choice We have an extra binary variable Zi . We would like to check whether Yi depends on Zi , and therefore need to choose between two models: M1 M2 Yi |Zi = k ∼i.i.d P(λk ) Yi ∼i.i.d P(λ) λ1 ∼ Γ(a, b) λ ∼ Γ(a, b) λ2 ∼ Γ(a, b) Robin J. Ryder Bayesian Case Studies, week 2
  • 4. The model index is a parameter We now consider an extra parameter M ∈ {1, 2} which indicates the model index. We can put a prior on M, for example a uniform prior: P[M = k] = 1/2. Inside model k, we note the parameters θk and the prior on θk is noted πk . We are then interested in the posterior distribution P[M = k|y ] ∝ P[M = k] L(θk |y )πk (θk )dθk Robin J. Ryder Bayesian Case Studies, week 2
  • 5. Bayes factor The evidence for or against a model given data is summarized in the Bayes factor: P[M = 2|y ]/P[M = 1|y ] B21 (y ) = ] P[M = 2]/P[M = 1] m2 (y ) = m1 (y ) where mk (y ) = L(θk |y )πk (θk )dθk Θk Robin J. Ryder Bayesian Case Studies, week 2
  • 6. Bayes factor Note that the quantity mk (y ) = L(θk |y )πk (θk )dθk Θk corresponds to the normalizing constant of the posterior when we write π(θk |y ) ∝ L(θk |y )πk (θk ) Robin J. Ryder Bayesian Case Studies, week 2
  • 7. Interpreting the Bayes factor Jeffrey’s scale of evidenc states that If log10 (B21 ) is between 0 and 0.5, then the evidence in favor of model 2 is weak between 0.5 and 1, it is substantial between 1 and 2, it is strong above 2, it is decisive (and symmetrically for negative values) Robin J. Ryder Bayesian Case Studies, week 2
  • 8. Analytical value Remember that ∞ Γ(a) λa−1 e −bλ dλ = 0 ba Robin J. Ryder Bayesian Case Studies, week 2
  • 9. Analytical value Remember that ∞ Γ(a) λa−1 e −bλ dλ = 0 ba Thus b a Γ(a + yi ) m1 (y ) = Γ(a) (b + n)a+ yi and b 2a Γ(a + yiH ) Γ(a + yiF ) m2 (y ) = Γ(a)2 (b + nH )a+ yiH (b + nF )a+ yiF Robin J. Ryder Bayesian Case Studies, week 2
  • 10. Monte Carlo Let I= h(x)g (x)dx where g is a density. Then take x1 , . . . , xN iid from g and we have ˆ 1 IMC = N h(xi ) N which converges (almost surely) to I. When implementing this, you need to check convergence! Robin J. Ryder Bayesian Case Studies, week 2
  • 11. Harmonic mean estimator Take a sample from the posterior distribution π1 (θ1 |y ). Note that 1 1 Eπ 1 |y = π1 (θ1 |y )dθ1 L(θ1 |y ) L(θ1 |y ) 1 π1 (θ1 )L(θ1 |y ) = dθ1 L(θ1 |y ) m1 (y ) 1 = m1 (y ) thus giving an easy way to estimate m1 (y ) by Monte Carlo. However, this method is in general not advised, since the associated estimator has infinite variance. Robin J. Ryder Bayesian Case Studies, week 2
  • 12. Importance sampling I= h(x)g (x)dx If we wish to perform Monte Carlo but cannot easily sample from g , we can re-write h(x)g (x) I= γ(x)dx γ(x) where γ is easy to sample from. Then take x1 , . . . , xN iid from γ and we have ˆ 1 h(xi )g (xi ) IIS = N N γ(xi ) Robin J. Ryder Bayesian Case Studies, week 2