SlideShare a Scribd company logo
1 of 584
Download to read offline
Markov Chain Monte Carlo Methods




                     Markov Chain Monte Carlo Methods

                                       Christian P. Robert

                              Universit´ Paris Dauphine and CREST-INSEE
                                       e
                              http://www.ceremade.dauphine.fr/~xian


                                       November 9, 2009
Markov Chain Monte Carlo Methods




Outline
      Motivation and leading example

      Random variable generation

      Monte Carlo Integration

      Notions on Markov Chains

      The Metropolis-Hastings Algorithm

      The Gibbs Sampler

      MCMC tools for variable dimension problems

      Sequential importance sampling
Markov Chain Monte Carlo Methods




                                   New [2004] edition:
Markov Chain Monte Carlo Methods
  Motivation and leading example




Motivation and leading example
      Motivation and leading example
        Introduction
        Likelihood methods
        Missing variable models
        Bayesian Methods
        Bayesian troubles

      Random variable generation

      Monte Carlo Integration

      Notions on Markov Chains

      The Metropolis-Hastings Algorithm
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction



Latent structures make life harder!



      Even simple models may lead to computational complications, as
      in latent variable models

                                   f (x|θ) =   f ⋆ (x, x⋆ |θ) dx⋆
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction



Latent structures make life harder!



      Even simple models may lead to computational complications, as
      in latent variable models

                                   f (x|θ) =   f ⋆ (x, x⋆ |θ) dx⋆

      If (x, x⋆ ) observed, fine!
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction



Latent structures make life harder!



      Even simple models may lead to computational complications, as
      in latent variable models

                                   f (x|θ) =   f ⋆ (x, x⋆ |θ) dx⋆

      If (x, x⋆ ) observed, fine!
      If only x observed, trouble!
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction


      Example (Mixture models)
      Models of mixtures of distributions:

                                    X ∼ fj with probability pj ,

      for j = 1, 2, . . . , k, with overall density

                                   X ∼ p1 f1 (x) + · · · + pk fk (x) .
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction


      Example (Mixture models)
      Models of mixtures of distributions:

                                       X ∼ fj with probability pj ,

      for j = 1, 2, . . . , k, with overall density

                                    X ∼ p1 f1 (x) + · · · + pk fk (x) .

      For a sample of independent random variables (X1 , · · · , Xn ),
      sample density
                                   n
                                         {p1 f1 (xi ) + · · · + pk fk (xi )} .
                                   i=1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction


      Example (Mixture models)
      Models of mixtures of distributions:

                                       X ∼ fj with probability pj ,

      for j = 1, 2, . . . , k, with overall density

                                    X ∼ p1 f1 (x) + · · · + pk fk (x) .

      For a sample of independent random variables (X1 , · · · , Xn ),
      sample density
                                   n
                                         {p1 f1 (xi ) + · · · + pk fk (xi )} .
                                   i=1

      Expanding this product involves k n elementary terms: prohibitive
      to compute in large samples.
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Introduction




                                                    Cas
           3
           2
      µ2

           1
           0
           −1




                      −1           0   1    2   3

                                       µ1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods



Maximum likelihood methods

         Go Bayes!!


          ◦ For an iid sample X1 , . . . , Xn from a population with density
            f (x|θ1 , . . . , θk ), the likelihood function is

                                   L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn )
                                                      n
                                              =             f (xi |θ1 , . . . , θk ).
                                                      i=1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods



Maximum likelihood methods

         Go Bayes!!


          ◦ For an iid sample X1 , . . . , Xn from a population with density
            f (x|θ1 , . . . , θk ), the likelihood function is

                                   L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn )
                                                      n
                                              =             f (xi |θ1 , . . . , θk ).
                                                      i=1



          ◦ Global justifications from asymptotics
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods



Maximum likelihood methods

         Go Bayes!!


          ◦ For an iid sample X1 , . . . , Xn from a population with density
            f (x|θ1 , . . . , θk ), the likelihood function is

                                   L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn )
                                                      n
                                              =             f (xi |θ1 , . . . , θk ).
                                                      i=1



          ◦ Global justifications from asymptotics
          ◦ Computational difficulty depends on structure, eg latent
            variables
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods




      Example (Mixtures again)
      For a mixture of two normal distributions,

                                   pN (µ, τ 2 ) + (1 − p)N (θ, σ 2 ) ,
      likelihood proportional to

                    n
                                       xi − µ                            xi − θ
                           pτ −1 ϕ               + (1 − p) σ −1 ϕ
                                          τ                                 σ
                   i=1

      containing 2n terms.
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods




      Standard maximization techniques often fail to find the global
      maximum because of multimodality of the likelihood function.
      Example
      In the special case
                                               ǫ
       f (x|µ, σ) = (1 − ǫ) exp{(−1/2)x2 } +     exp{(−1/2σ 2 )(x − µ)2 }
                                               σ
                                                                      (1)
      with ǫ > 0 known,
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Likelihood methods




      Standard maximization techniques often fail to find the global
      maximum because of multimodality of the likelihood function.
      Example
      In the special case
                                              ǫ
       f (x|µ, σ) = (1 − ǫ) exp{(−1/2)x2 } +    exp{(−1/2σ 2 )(x − µ)2 }
                                             σ
                                                                     (1)
      with ǫ > 0 known, whatever n, the likelihood is unbounded:

                                   lim ℓ(µ = x1 , σ|x1 , . . . , xn ) = ∞
                                   σ→0
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models



The special case of missing variable models


      Consider again a latent variable representation

                                   g(x|θ) =       f (x, z|θ) dz
                                              Z
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models



The special case of missing variable models


      Consider again a latent variable representation

                                   g(x|θ) =       f (x, z|θ) dz
                                              Z

       Define the completed (but unobserved) likelihood

                                    Lc (θ|x, z) = f (x, z|θ)
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models



The special case of missing variable models


      Consider again a latent variable representation

                                   g(x|θ) =       f (x, z|θ) dz
                                              Z

       Define the completed (but unobserved) likelihood

                                    Lc (θ|x, z) = f (x, z|θ)

      Useful for optimisation algorithm
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models



The EM Algorithm
         Gibbs connection                                               Bayes rather than EM


      Algorithm (Expectation–Maximisation)
      Iterate (in m)
        1. (E step) Compute
                                   ˆ                             ˆ
                               Q(θ|θ(m) , x) = E[log Lc (θ|x, Z)|θ(m) , x] ,
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models



The EM Algorithm
         Gibbs connection                                               Bayes rather than EM


      Algorithm (Expectation–Maximisation)
      Iterate (in m)
        1. (E step) Compute
                                   ˆ                             ˆ
                               Q(θ|θ(m) , x) = E[log Lc (θ|x, Z)|θ(m) , x] ,
                                 ˆ
        2. (M step) Maximise Q(θ|θ(m) , x) in θ and take

                                   ˆ                    ˆ
                                   θ(m+1) = arg max Q(θ|θ(m) , x).
                                                    θ



      until a fixed point [of Q] is reached
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models




                                        Echantillon N(0,1)
          0.6
          0.5
          0.4
          0.3
          0.2
          0.1
          0.0




                       −2          −1         0              1   2
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Missing variable models




                                                    Likeli
           3
           2
      µ2

           1
           0
           −1




                       −1          0   1    2   3

                                       µ1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



The Bayesian Perspective



      In the Bayesian paradigm, the information brought by the data x,
      realization of
                                 X ∼ f (x|θ),
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



The Bayesian Perspective



      In the Bayesian paradigm, the information brought by the data x,
      realization of
                                 X ∼ f (x|θ),
      is combined with prior information specified by prior distribution
      with density
                                    π(θ)
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool

      Summary in a probability distribution, π(θ|x), called the posterior
      distribution
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool

      Summary in a probability distribution, π(θ|x), called the posterior
      distribution
      Derived from the joint distribution f (x|θ)π(θ), according to

                                              f (x|θ)π(θ)
                                   π(θ|x) =                 ,
                                              f (x|θ)π(θ)dθ

                                                                [Bayes Theorem]
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool

      Summary in a probability distribution, π(θ|x), called the posterior
      distribution
      Derived from the joint distribution f (x|θ)π(θ), according to

                                              f (x|θ)π(θ)
                                   π(θ|x) =                 ,
                                              f (x|θ)π(θ)dθ

                                                                [Bayes Theorem]
      where
                                   m(x) =     f (x|θ)π(θ)dθ

      is the marginal density of X
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool...central to Bayesian inference
      Posterior defined up to a constant as

                                   π(θ|x) ∝ f (x|θ) π(θ)


         ◮   Operates conditional upon the observations
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool...central to Bayesian inference
      Posterior defined up to a constant as

                                   π(θ|x) ∝ f (x|θ) π(θ)


         ◮   Operates conditional upon the observations
         ◮   Integrate simultaneously prior information and information
             brought by x
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool...central to Bayesian inference
      Posterior defined up to a constant as

                                   π(θ|x) ∝ f (x|θ) π(θ)


         ◮   Operates conditional upon the observations
         ◮   Integrate simultaneously prior information and information
             brought by x
         ◮   Avoids averaging over the unobserved values of x
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool...central to Bayesian inference
      Posterior defined up to a constant as

                                   π(θ|x) ∝ f (x|θ) π(θ)


         ◮   Operates conditional upon the observations
         ◮   Integrate simultaneously prior information and information
             brought by x
         ◮   Avoids averaging over the unobserved values of x
         ◮   Coherent updating of the information available on θ,
             independent of the order in which i.i.d. observations are
             collected
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian Methods



Central tool...central to Bayesian inference
      Posterior defined up to a constant as

                                   π(θ|x) ∝ f (x|θ) π(θ)


         ◮   Operates conditional upon the observations
         ◮   Integrate simultaneously prior information and information
             brought by x
         ◮   Avoids averaging over the unobserved values of x
         ◮   Coherent updating of the information available on θ,
             independent of the order in which i.i.d. observations are
             collected
         ◮   Provides a complete inferential scope and a unique motor of
             inference
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



Conjugate bonanza...


      Example (Binomial)
      For an observation X ∼ B(n, p) so-called conjugate prior is the
      family of beta Be(a, b) distributions
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



Conjugate bonanza...


      Example (Binomial)
      For an observation X ∼ B(n, p) so-called conjugate prior is the
      family of beta Be(a, b) distributions
      The classical Bayes estimator δ π is the posterior mean
                                                1
                         Γ(a + b + n)
                                                    p px+a−1 (1 − p)n−x+b−1 dp
                     Γ(a + x)Γ(n − x + b)   0
                         x+a
                     =          .
                       a+b+n
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Normal)
      In the normal N (µ, σ 2 ) case, with both µ and σ unknown,
      conjugate prior on θ = (µ, σ 2 ) of the form

                             (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Normal)
      In the normal N (µ, σ 2 ) case, with both µ and σ unknown,
      conjugate prior on θ = (µ, σ 2 ) of the form

                             (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2

      since

      π((µ, σ 2 )|x1 , . . . , xn ) ∝ (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2
                                           ×(σ 2 )−n exp − n(µ − x)2 + s2 /σ 2
                                                                        x

                                     ∝ (σ 2 )−λσ +n exp − (λµ + n)(µ − ξx )2

                                                        nλµ
                                           +α + s2 +
                                                 x              /σ 2
                                                       n + λµ
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



...and conjugate curse



      The use of conjugate priors for computational reasons
          • implies a restriction on the modeling of the available prior
            information
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



...and conjugate curse



      The use of conjugate priors for computational reasons
          • implies a restriction on the modeling of the available prior
            information
          • may be detrimental to the usefulness of the Bayesian approach
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



...and conjugate curse



      The use of conjugate priors for computational reasons
          • implies a restriction on the modeling of the available prior
            information
          • may be detrimental to the usefulness of the Bayesian approach
          • gives an impression of subjective manipulation of the prior
            information disconnected from reality.
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



A typology of Bayes computational problems
       (i). use of a complex parameter space, as for instance in
            constrained parameter sets like those resulting from imposing
            stationarity constraints in dynamic models;
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



A typology of Bayes computational problems
       (i). use of a complex parameter space, as for instance in
            constrained parameter sets like those resulting from imposing
            stationarity constraints in dynamic models;
      (ii). use of a complex sampling model with an intractable
            likelihood, as for instance in missing data and graphical
            models;
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



A typology of Bayes computational problems
       (i). use of a complex parameter space, as for instance in
            constrained parameter sets like those resulting from imposing
            stationarity constraints in dynamic models;
      (ii). use of a complex sampling model with an intractable
            likelihood, as for instance in missing data and graphical
            models;
     (iii). use of a huge dataset;
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



A typology of Bayes computational problems
       (i). use of a complex parameter space, as for instance in
            constrained parameter sets like those resulting from imposing
            stationarity constraints in dynamic models;
      (ii). use of a complex sampling model with an intractable
            likelihood, as for instance in missing data and graphical
            models;
     (iii). use of a huge dataset;
     (iv). use of a complex prior distribution (which may be the
           posterior distribution associated with an earlier sample);
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles



A typology of Bayes computational problems
       (i). use of a complex parameter space, as for instance in
            constrained parameter sets like those resulting from imposing
            stationarity constraints in dynamic models;
      (ii). use of a complex sampling model with an intractable
            likelihood, as for instance in missing data and graphical
            models;
     (iii). use of a huge dataset;
     (iv). use of a complex prior distribution (which may be the
           posterior distribution associated with an earlier sample);
      (v). use of a complex inferential procedure as for instance, Bayes
           factors

                                    π          P (θ ∈ Θ0 | x)   π(θ ∈ Θ0 )
                                   B01 (x) =                               .
                                               P (θ ∈ Θ1 | x)   π(θ ∈ Θ1 )
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles


      Example (Mixture once again)
      Observations from

              x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 )
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles


      Example (Mixture once again)
      Observations from

              x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 )

      Prior
                        2
      µi |σi ∼ N (ξi , σi /ni ),         2
                                        σi ∼ I G (νi /2, s2 /2),
                                                          i             p ∼ Be(α, β)
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles


      Example (Mixture once again)
      Observations from

              x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 )

      Prior
                        2
      µi |σi ∼ N (ξi , σi /ni ),                2
                                               σi ∼ I G (νi /2, s2 /2),
                                                                 i            p ∼ Be(α, β)

      Posterior
                                        n
      π(θ|x1 , . . . , xn ) ∝                {pϕ(xj ; µ1 , σ1 ) + (1 − p)ϕ(xj ; µ2 , σ2 )} π(θ)
                                       j=1
                                        n
                                   =               ω(kt )π(θ|(kt ))
                                       ℓ=0 (kt )

                                                                                         n
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Mixture once again (cont’d))
      For a given permutation (kt ), conditional posterior distribution
                                                         2
                                                        σ1
             π(θ|(kt )) = N               ξ1 (kt ),             × I G ((ν1 + ℓ)/2, s1 (kt )/2)
                                                      n1 + ℓ
                                      2
                                     σ2
                     ×N            ξ2 (kt ),                   × I G ((ν2 + n − ℓ)/2, s2 (kt )/2)
                                 n2 + n − ℓ
                     ×Be(α + ℓ, β + n − ℓ)
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Mixture once again (cont’d))
      where
                            1   ℓ                               ℓ                   2
        x1 (kt ) =
        ¯                   ℓ   t=1 xkt ,       s1 (kt ) =
                                                ˆ               t=1 (xkt − x1 (kt )) ,
                                                                           ¯
                             1    n                            n                      2
        x2 (kt ) =
        ¯                   n−ℓ   t=ℓ+1 xkt ,   s2 (kt ) =
                                                ˆ              t=ℓ+1 (xkt − x2 (kt ))
                                                                             ¯

      and
                   n1 ξ1 + ℓ¯1 (kt )
                            x                         n2 ξ2 + (n − ℓ)¯2 (kt )
                                                                      x
        ξ1 (kt ) =                   ,     ξ2 (kt ) =                         ,
                        n1 + ℓ                               n2 + n − ℓ
                                      n1 ℓ
        s1 (kt ) = s2 + s2 (kt ) +
                    1    ˆ1                (ξ1 − x1 (kt ))2 ,
                                                   ¯
                                   n1 + ℓ
                                    n2 (n − ℓ)
        s2 (kt ) = s2 + s2 (kt ) +
                    2    ˆ2                     (ξ2 − x2 (kt ))2 ,
                                                       ¯
                                   n2 + n − ℓ
      posterior updates of the hyperparameters
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Mixture once again)
      Bayes estimator of θ:
                                                     n
                         δ π (x1 , . . . , xn ) =               ω(kt )Eπ [θ|x, (kt )]
                                                    ℓ=0 (kt )

                                       Too costly: 2n terms
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




         press for AR


      Example (Poly-t priors)
      Normal observation x ∼ N (θ, 1), with conjugate prior

                                            θ ∼ N (µ, ǫ)

      Closed form expression for the posterior mean

                             θ f (x|θ) π(θ) dθ            f (x|θ) π(θ) dθ =
                         Θ                            Θ
                                                     x + ǫ−2 µ
                                                 =             .
                                                      1 + ǫ−2
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Poly-t priors (2))
      More involved prior distribution:
      poly-t distribution
                                                                      [Bauwens,1985]
                                   k
                                                           −νi
                         π(θ) =          αi + (θ − βi )2         αi , νi > 0
                                   i=1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (Poly-t priors (2))
      More involved prior distribution:
      poly-t distribution
                                                                      [Bauwens,1985]
                                   k
                                                           −νi
                         π(θ) =          αi + (θ − βi )2         αi , νi > 0
                                   i=1

      Computation of E[θ|x] ???
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (AR(p) model)
      Auto-regressive representation of a time series,
                                           p
                                   xt =         θi xt−i + σεt
                                          i=1
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (AR(p) model)
      Auto-regressive representation of a time series,
                                            p
                                    xt =         θi xt−i + σεt
                                           i=1

      If order p unknown, predictive distribution of xt+1 given by

      π(xt+1 |xt , . . . , x1 ) ∝    f (xt+1 |xt , . . . , xt−p+1 )π(θ, p|xt , . . . , x1 )dp dθ ,
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (AR(p) model (cont’d))
      Integration over the parameters of all models
        ∞
                  f (xt+1 |xt , . . . , xt−p+1 )π(θ|p, xt , . . . , x1 ) dθ π(p|xt , . . . , x1 ) .
       p=0
Markov Chain Monte Carlo Methods
  Motivation and leading example
     Bayesian troubles




      Example (AR(p) model (cont’d))
      Multiple layers of complexity
       (i). Complex parameter space within each AR(p) model because
            of stationarity constraint
      (ii). if p unbounded, infinity of models
     (iii). θ varies between models AR(p) and AR(p + 1), with a
            different stationarity constraint (except for root
            reparameterisation).
     (iv). if prediction used sequentially, every tick/second/hour/day,
           posterior distribution π(θ, p|xt , . . . , x1 ) must be re-evaluated
Markov Chain Monte Carlo Methods
  Random variable generation




Random variable generation
      Motivation and leading example

      Random variable generation
         Basic methods
         Uniform pseudo-random generator
         Beyond Uniform distributions
         Transformation methods
         Accept-Reject Methods
         Fundamental theorem of simulation
         Log-concave densities

      Monte Carlo Integration

      Notions on Markov Chains
Markov Chain Monte Carlo Methods
  Random variable generation




Random variable generation



          • Rely on the possibility of producing (computer-wise) an
            endless flow of random variables (usually iid) from well-known
            distributions
Markov Chain Monte Carlo Methods
  Random variable generation




Random variable generation



          • Rely on the possibility of producing (computer-wise) an
            endless flow of random variables (usually iid) from well-known
            distributions
          • Given a uniform random number generator, illustration of
            methods that produce random variables from both standard
            and nonstandard distributions
Markov Chain Monte Carlo Methods
  Random variable generation
     Basic methods



The inverse transform method



      For a function F on R, the generalized inverse of F , F − , is defined
      by
                        F − (u) = inf {x; F (x) ≥ u} .
Markov Chain Monte Carlo Methods
  Random variable generation
     Basic methods



The inverse transform method



      For a function F on R, the generalized inverse of F , F − , is defined
      by
                        F − (u) = inf {x; F (x) ≥ u} .

      Definition (Probability Integral Transform)
      If U ∼ U[0,1] , then the random variable F − (U ) has the distribution
      F.
Markov Chain Monte Carlo Methods
  Random variable generation
     Basic methods



The inverse transform method (2)



      To generate a random variable X ∼ F , simply generate

                                   U ∼ U[0,1]
Markov Chain Monte Carlo Methods
  Random variable generation
     Basic methods



The inverse transform method (2)



      To generate a random variable X ∼ F , simply generate

                                   U ∼ U[0,1]

      and then make the transform

                                   x = F − (u)
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Desiderata and limitations
         skip Uniform


          • Production of a deterministic sequence of values in [0, 1] which
            imitates a sequence of iid uniform random variables U[0,1] .
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Desiderata and limitations
         skip Uniform


          • Production of a deterministic sequence of values in [0, 1] which
            imitates a sequence of iid uniform random variables U[0,1] .
          • Can’t use the physical imitation of a “random draw” [no
            guarantee of uniformity, no reproducibility]
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Desiderata and limitations
         skip Uniform


          • Production of a deterministic sequence of values in [0, 1] which
            imitates a sequence of iid uniform random variables U[0,1] .
          • Can’t use the physical imitation of a “random draw” [no
            guarantee of uniformity, no reproducibility]
          • Random sequence in the sense: Having generated
            (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts
            no discernible knowledge of the value of Xn+1 .
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Desiderata and limitations
         skip Uniform


          • Production of a deterministic sequence of values in [0, 1] which
            imitates a sequence of iid uniform random variables U[0,1] .
          • Can’t use the physical imitation of a “random draw” [no
            guarantee of uniformity, no reproducibility]
          • Random sequence in the sense: Having generated
            (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts
            no discernible knowledge of the value of Xn+1 .
          • Deterministic: Given the initial value X0 , sample
            (X1 , · · · , Xn ) always the same
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Desiderata and limitations
         skip Uniform


          • Production of a deterministic sequence of values in [0, 1] which
            imitates a sequence of iid uniform random variables U[0,1] .
          • Can’t use the physical imitation of a “random draw” [no
            guarantee of uniformity, no reproducibility]
          • Random sequence in the sense: Having generated
            (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts
            no discernible knowledge of the value of Xn+1 .
          • Deterministic: Given the initial value X0 , sample
            (X1 , · · · , Xn ) always the same
          • Validity of a random number generator based on a single
            sample X1 , · · · , Xn when n tends to +∞, not on replications
                        (X11 , · · · , X1n ), (X21 , · · · , X2n ), . . . (Xk1 , · · · , Xkn )
             where n fixed and k tends to infinity.
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Uniform pseudo-random generator


      Algorithm starting from an initial value 0 ≤ u0 ≤ 1 and a
      transformation D, which produces a sequence

                                       (ui ) = (Di (u0 ))

      in [0, 1].
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Uniform pseudo-random generator


      Algorithm starting from an initial value 0 ≤ u0 ≤ 1 and a
      transformation D, which produces a sequence

                                       (ui ) = (Di (u0 ))

      in [0, 1].
      For all n,
                                        (u1 , · · · , un )
      reproduces the behavior of an iid U[0,1] sample (V1 , · · · , Vn ) when
      compared through usual tests
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Uniform pseudo-random generator (2)


          • Validity means the sequence U1 , · · · , Un leads to accept the
            hypothesis

                                       H : U1 , · · · , Un   are iid   U[0,1] .
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Uniform pseudo-random generator (2)


          • Validity means the sequence U1 , · · · , Un leads to accept the
            hypothesis

                                       H : U1 , · · · , Un   are iid   U[0,1] .


          • The set of tests used is generally of some consequence
                 ◦ Kolmogorov–Smirnov and other nonparametric tests
                 ◦ Time series methods, for correlation between Ui and
                   (Ui−1 , · · · , Ui−k )
                 ◦ Marsaglia’s battery of tests called Die Hard (!)
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Usual generators
      In R and S-plus, procedure runif()
      The Uniform Distribution

      Description:
      ‘runif’ generates random deviates.

      Example:
           u <- runif(20)

      ‘.Random.seed’ is an integer vector, containing
      the random number generator state for random
      number generation in R. It can be saved and
      restored, but should not be altered by users.
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator

          0.0 0.2 0.4 0.6 0.8 1.0




                                    500   520   540                    560   580   600

                                                      uniform sample
          1.5
          1.0
          0.5
          0.0




                                    0.0   0.2   0.4                    0.6   0.8   1.0
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Usual generators (2)
      In C, procedure rand() or random()
      SYNOPSIS
             #include <stdlib.h>
             long int random(void);
      DESCRIPTION
      The random() function uses a non-linear additive
      feedback random number generator employing a
      default table of size 31 long integers to return
      successive pseudo-random numbers in the range
      from 0 to RAND_MAX. The period of this random
      generator is very large, approximately
      16*((2**31)-1).
      RETURN VALUE
      random() returns a value between 0 and RAND_MAX.
Markov Chain Monte Carlo Methods
  Random variable generation
     Uniform pseudo-random generator



Usual generators(3)

      In Scilab, procedure rand()


      rand() : with no arguments gives a scalar whose
      value changes each time it is referenced. By
      default, random numbers are uniformly distributed
      in the interval (0,1). rand(’normal’) switches to
      a normal distribution with mean 0 and variance 1.

      EXAMPLE
        x=rand(10,10,’uniform’)
Markov Chain Monte Carlo Methods
  Random variable generation
     Beyond Uniform distributions



Beyond Uniform generators

          • Generation of any sequence of random variables can be
            formally implemented through a uniform generator
                  ◦ Distributions with explicit F − (for instance, exponential, and
                    Weibull distributions), use the probability integral
                    transform here
Markov Chain Monte Carlo Methods
  Random variable generation
     Beyond Uniform distributions



Beyond Uniform generators

          • Generation of any sequence of random variables can be
            formally implemented through a uniform generator
                  ◦ Distributions with explicit F − (for instance, exponential, and
                    Weibull distributions), use the probability integral
                    transform here
                  ◦ Case specific methods rely on properties of the distribution (for
                    instance, normal distribution, Poisson distribution)
Markov Chain Monte Carlo Methods
  Random variable generation
     Beyond Uniform distributions



Beyond Uniform generators

          • Generation of any sequence of random variables can be
            formally implemented through a uniform generator
                  ◦ Distributions with explicit F − (for instance, exponential, and
                    Weibull distributions), use the probability integral
                    transform here
                  ◦ Case specific methods rely on properties of the distribution (for
                    instance, normal distribution, Poisson distribution)
                  ◦ More generic methods (for instance, accept-reject and
                    ratio-of-uniform)
Markov Chain Monte Carlo Methods
  Random variable generation
     Beyond Uniform distributions



Beyond Uniform generators

          • Generation of any sequence of random variables can be
            formally implemented through a uniform generator
                  ◦ Distributions with explicit F − (for instance, exponential, and
                    Weibull distributions), use the probability integral
                    transform here
                  ◦ Case specific methods rely on properties of the distribution (for
                    instance, normal distribution, Poisson distribution)
                  ◦ More generic methods (for instance, accept-reject and
                    ratio-of-uniform)
          • Simulation of the standard distributions is accomplished quite
            efficiently by many numerical and statistical programming
            packages.
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Transformation methods
      Case where a distribution F is linked in a simple way to another
      distribution easy to simulate.

      Example (Exponential variables)
      If U ∼ U[0,1] , the random variable

                                    X = − log U/λ

      has distribution

                         P (X ≤ x) = P (− log U ≤ λx)
                                   = P (U ≥ e−λx ) = 1 − e−λx ,

      the exponential distribution E xp(λ).
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods




      Other random variables that can be generated starting from an
      exponential include

                                                   ν
                                     Y = −2             log(Uj ) ∼ χ2
                                                                    2ν
                                                  j=1



                                              a
                                        1
                                   Y =−            log(Uj ) ∼ G a(a, β)
                                        β
                                            j=1


                                            a
                                            j=1 log(Uj )
                                   Y =      a+b
                                                             ∼ Be(a, b)
                                            j=1 log(Uj )
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Points to note



          ◦ Transformation quite simple to use
          ◦ There are more efficient algorithms for gamma and beta
            random variables
          ◦ Cannot generate gamma random variables with a non-integer
            shape parameter
          ◦ For instance, cannot get a χ2 variable, which would get us a
                                        1
            N (0, 1) variable.
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Box-Muller Algorithm

      Example (Normal variables)
      If r, θ polar coordinates of (X1 , X2 ), then,

                 r2 = X1 + X2 ∼ χ2 = E (1/2)
                       2    2
                                 2                and θ ∼ U [0, 2π]
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Box-Muller Algorithm

      Example (Normal variables)
      If r, θ polar coordinates of (X1 , X2 ), then,

                 r2 = X1 + X2 ∼ χ2 = E (1/2)
                       2    2
                                 2                and θ ∼ U [0, 2π]

      Consequence: If U1 , U2 iid U[0,1] ,

                               X1 =   −2 log(U1 ) cos(2πU2 )
                               X2 =   −2 log(U1 ) sin(2πU2 )

      iid N (0, 1).
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Box-Muller Algorithm (2)


            1. Generate U1 , U2 iid U[0,1] ;
            2. Define

                               x1 =   −2 log(u1 ) cos(2πu2 ) ,
                               x2 =   −2 log(u1 ) sin(2πu2 ) ;

            3. Take x1 and x2 as two independent draws from
               N (0, 1).
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Box-Muller Algorithm (3)



         ◮   Unlike algorithms based on the CLT,




                                                         3
             this algorithm is exact




                                                         2
                                                         1
             Get two normals for the price of




                                                         0
         ◮




                                                         −1
             two uniforms




                                                         −2
                                                         −3
                              ◮ Drawback (in speed)




                                                         −4
               0.4




                                                              −4   −2   0   2   4



                                 in calculating log, cos and sin.
               0.3
               0.2
               0.1
               0.0




                     −4   −2   0   2   4
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



More transforms


         Reject


      Example (Poisson generation)
      Poisson–exponential connection:
      If N ∼ P(λ) and Xi ∼ E xp(λ), i ∈ N∗ ,

                   Pλ (N = k) =
                          Pλ (X1 + · · · + Xk ≤ 1 < X1 + · · · + Xk+1 ) .
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



More Poisson


                                                                   Skip Poisson


          • A Poisson can be simulated by generating Exp(1) till their
            sum exceeds 1.
          • This method is simple, but is really practical only for smaller
            values of λ.
          • On average, the number of exponential variables required is λ.
          • Other approaches are more suitable for large λ’s.
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Atkinson’s Poisson
          To generate N ∼ P(λ):
            1. Define
                     √
               β = π/ 3λ,              α = λβ     and    k = log c−λ−log β;

            2. Generate U1 ∼ U[0,1] and calculate

                                   x = {α − log{(1 − u1 )/u1 }}/β

                 until x > −0.5 ;
            3. Define N = ⌊x + 0.5⌋ and generate
               U2 ∼ U[0,1] ;
            4. Accept N if

                 α−βx+log (u2 /{1+exp(α−βx)}2 ) ≤ k+N log λ−log N ! .
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Negative extension



         ◮   A generator of Poisson random variables can produce negative
             binomial random variables since,

                                   Y ∼ Ga(n, (1 − p)/p)   X|y ∼ P(y)

             implies
                                            X ∼ N eg(n, p)
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Mixture representation


          • The representation of the negative binomial is a particular
            case of a mixture distribution
          • The principle of a mixture representation is to represent a
            density f as the marginal of another distribution, for example

                                   f (x) =         pi fi (x) ,
                                             i∈Y

          • If the component distributions fi (x) can be easily generated,
            X can be obtained by first choosing fi with probability pi and
            then generating an observation from fi .
Markov Chain Monte Carlo Methods
  Random variable generation
     Transformation methods



Partitioned sampling



      Special case of mixture sampling when

                               fi (x) = f (x) IAi (x)        f (x) dx
                                                        Ai

      and
                                        pi = Pr(X ∈ Ai )
      for a partition (Ai )i
Markov Chain Monte Carlo Methods
  Random variable generation
     Accept-Reject Methods



Accept-Reject algorithm


          • Many distributions from which it is difficult, or even
            impossible, to directly simulate.
          • Another class of methods that only require us to know the
            functional form of the density f of interest only up to a
            multiplicative constant.
          • The key to this method is to use a simpler (simulation-wise)
            density g, the instrumental density , from which the simulation
            from the target density f is actually done.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Fundamental theorem of simulation




                                                0.25
   Lemma




                                                0.20
   Simulating




                                                0.15
                     X ∼ f (x)


                                         f(x)

                                                0.10
   equivalent to simulating
                                                0.05


   (X, U ) ∼ U{(x, u) : 0 < u < f (x)}
                                                0.00




                                                       0   2   4       6   8   10

                                                                   x
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



The Accept-Reject algorithm


      Given a density of interest f , find a density g and a constant M
      such that
                                 f (x) ≤ M g(x)
      on the support of f .
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



The Accept-Reject algorithm


      Given a density of interest f , find a density g and a constant M
      such that
                                 f (x) ≤ M g(x)
      on the support of f .

            1. Generate X ∼ g, U ∼ U[0,1] ;
            2. Accept Y = X if U ≤ f (X)/M g(X) ;
            3. Return to 1. otherwise.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Validation of the Accept-Reject method
      Warranty:
      This algorithm produces a variable Y distributed according to f
                                5
                                4
                                3
                                2
                                1
                                0




                                         −4   −2   0   2   4
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Two interesting properties


          ◦ First, it provides a generic method to simulate from any
            density f that is known up to a multiplicative factor
            Property particularly important in Bayesian calculations where
            the posterior distribution

                                         π(θ|x) ∝ π(θ) f (x|θ) .

               is specified up to a normalizing constant
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Two interesting properties


          ◦ First, it provides a generic method to simulate from any
            density f that is known up to a multiplicative factor
            Property particularly important in Bayesian calculations where
            the posterior distribution

                                         π(θ|x) ∝ π(θ) f (x|θ) .

               is specified up to a normalizing constant
          ◦ Second, the probability of acceptance in the algorithm is
            1/M , e.g., expected number of trials until a variable is
            accepted is M
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



More interesting properties


          ◦ In cases f and g both probability densities, the constant M is
            necessarily larger that 1.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



More interesting properties


          ◦ In cases f and g both probability densities, the constant M is
            necessarily larger that 1.
          ◦ The size of M , and thus the efficiency of the algorithm, are
            functions of how closely g can imitate f , especially in the tails
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



More interesting properties


          ◦ In cases f and g both probability densities, the constant M is
            necessarily larger that 1.
          ◦ The size of M , and thus the efficiency of the algorithm, are
            functions of how closely g can imitate f , especially in the tails
          ◦ For f /g to remain bounded, necessary for g to have tails
            thicker than those of f .
            It is therefore impossible to use the A-R algorithm to simulate
            a Cauchy distribution f using a normal distribution g, however
            the reverse works quite well.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




                                                                 No Cauchy!


      Example (Normal from a Cauchy)
      Take
                                                  1
                                         f (x) = √ exp(−x2 /2)
                                                  2π
      and
                                      1 1
                                            g(x) =
                                               ,
                                      π 1 + x2
      densities of the normal and Cauchy distributions.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




                                                                 No Cauchy!


      Example (Normal from a Cauchy)
      Take
                                                  1
                                         f (x) = √ exp(−x2 /2)
                                                  2π
      and
                                         1 1
                                            g(x) =,
                                         π 1 + x2
      densities of the normal and Cauchy distributions.
      Then
                   f (x)    π                2      2π
                         =     (1 + x2 ) e−x /2 ≤       = 1.52
                   g(x)      2                       e
       attained at x = ±1.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Normal from a Cauchy (2))
      So probability of acceptance

                                         1/1.52 = 0.66,

      and, on the average, one out of every three simulated Cauchy
      variables is rejected.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




                                                                  No Double!


      Example (Normal/Double Exponential)
      Generate a N (0, 1) by using a double-exponential distribution
      with density
                         g(x|α) = (α/2) exp(−α|x|)
      Then
                                          f (x)     2 −1 −α2 /2
                                                ≤     α e
                                         g(x|α)     π
      and minimum of this bound (in α) attained for

                                                α⋆ = 1
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Normal/Double Exponential (2))
      Probability of acceptance

                                         π/2e = .76

      To produce one normal random variable requires on the average
      1/.76 ≈ 1.3 uniform variables.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




         truncate


      Example (Gamma generation)
      Illustrates a real advantage of the Accept-Reject algorithm
      The gamma distribution Ga(α, β) represented as the sum of α
      exponential random variables, only if α is an integer
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Gamma generation (2))
      Can use the Accept-Reject algorithm with instrumental distribution

                                   Ga(a, b), with a = [α],   α ≥ 0.

      (Without loss of generality, β = 1.)
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Gamma generation (2))
      Can use the Accept-Reject algorithm with instrumental distribution

                                   Ga(a, b), with a = [α],   α ≥ 0.

      (Without loss of generality, β = 1.)
      Up to a normalizing constant,
                                                                            α−a
                                                                  α−a
              f /gb = b−a xα−a exp{−(1 − b)x} ≤ b−a
                                                                 (1 − b)e

      for b ≤ 1.
      The maximum is attained at b = a/α.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Cheng and Feast’s Gamma generator
      Gamma G a(α, 1), α > 1 distribution
            1. Define c1 = α − 1, c2 = (α − (1/6α))/c1 ,
                                                    √
               c3 = 2/c1 , c4 = 1 + c3 , and c5 = 1/ α.
            2. Repeat
                          generate U1 , U2
                 take U1 = U2 + c5 (1 − 1.86U1 ) if α > 2.5
                 until 0 < U1 < 1.
            3. Set W = c2 U2 /U1 .
            4. If c3 U1 + W + W −1 ≤ c4 or
               c3 log U1 − log W + W ≤ 1,
               take c1 W ;
               otherwise, repeat.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Truncated Normal simulation

      Example (Truncated Normal distributions)
      Constraint x ≥ µ produces density proportional to
                                                   2 /2σ 2
                                         e−(x−µ)             Ix≥µ

      for a bound µ large compared with µ
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation



Truncated Normal simulation

      Example (Truncated Normal distributions)
      Constraint x ≥ µ produces density proportional to
                                                   2 /2σ 2
                                         e−(x−µ)             Ix≥µ

      for a bound µ large compared with µ
      There exists alternatives far superior to the na¨ method of
                                                      ıve
      generating a N (µ, σ 2 ) until exceeding µ, which requires an average

      number of
                                 1/Φ((µ − µ)/σ)
      simulations from N (µ, σ 2 ) for a single acceptance.
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Truncated Normal distributions (2))
      Instrumental distribution: translated exponential distribution,
      E (α, µ), with density

                                         gα (z) = αe−α(z−µ) Iz≥µ .
Markov Chain Monte Carlo Methods
  Random variable generation
     Fundamental theorem of simulation




      Example (Truncated Normal distributions (2))
      Instrumental distribution: translated exponential distribution,
      E (α, µ), with density

                                         gα (z) = αe−α(z−µ) Iz≥µ .

      The ratio f /gα is bounded by

                                         1/α exp(α2 /2 − αµ) if α > µ ,
                        f /gα ≤
                                         1/α exp(−µ2 /2)     otherwise.
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



Log-concave densities (1)



                      Densities f whose logarithm is concave, for
         move to next chapter

      instance Bayesian posterior distributions such that

                             log π(θ|x) = log π(θ) + log f (x|θ) + c

      concave
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



Log-concave densities (2)


      Take
                             Sn = {xi , i = 0, 1, . . . , n + 1} ⊂ supp(f )
      such that h(xi ) = log f (xi ) known up to the same constant.
      By concavity of h, line Li,i+1 through (xi , h(xi )) and
      (xi+1 , h(xi+1 ))
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



Log-concave densities (2)


      Take
                             Sn = {xi , i = 0, 1, . . . , n + 1} ⊂ supp(f )
      such that h(xi ) = log f (xi ) known up to the same constant.
      By concavity of h, line Li,i+1 through (xi , h(xi )) and
      (xi+1 , h(xi+1 ))

          ◮   below h in [xi , xi+1 ] and
          ◮   above this graph outside this interval
                                                                           L 2,3 (x)

                                                                                                log f(x)

                                                                 x1   x2    x3             x4
                                                                                       x
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



Log-concave densities (3)

      For x ∈ [xi , xi+1 ], if

        hn (x) = min{Li−1,i (x), Li+1,i+2 (x)} and          hn (x) = Li,i+1 (x) ,

      the envelopes are
                                   hn (x) ≤ h(x) ≤ hn (x)
      uniformly on the support of f , with

                hn (x) = −∞ and hn (x) = min(L0,1 (x), Ln,n+1 (x))

      on [x0 , xn+1 ]c .
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



Log-concave densities (4)



      Therefore, if

                             f n (x) = exp hn (x) and f n (x) = exp hn (x)

      then
                                f n (x) ≤ f (x) ≤ f n (x) = ̟n gn (x) ,
      where ̟n normalizing constant of fn
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities



ARS Algorithm




             1. Initialize n and Sn .
             2. Generate X ∼ gn (x), U ∼ U[0,1] .
             3. If U ≤ f n (X)/̟n gn (X), accept X;
                otherwise, if U ≤ f (X)/̟n gn (X), accept X
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




         kill ducks


      Example (Northern Pintail ducks)
      Ducks captured at time i with both probability pi and size N of
      the population unknown.
      Dataset

                         (n1 , . . . , n11 ) = (32, 20, 8, 5, 1, 2, 0, 2, 1, 1, 0)

      Number of recoveries over the years 1957–1968 of N = 1612
      Northern Pintail ducks banded in 1956
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




      Example (Northern Pintail ducks (2))
      Corresponding conditional likelihood
                                                                  I
                                                        N!
          L(p1 , . . . , pI |N, n1 , . . . , nI ) =                    pni (1 − pi )N −ni ,
                                                                        i
                                                      (N − r)!
                                                                 i=1

      where I number of captures, ni number of captured animals
      during the ith capture, and r is the total number of different
      captured animals.
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




      Example (Northern Pintail ducks (3))
      Prior selection
      If
                                              N ∼ P(λ)
      and
                                                pi
                                   αi = log            ∼ N (µi , σ 2 ),
                                              1 − pi
                                                                          [Normal logistic]
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




      Example (Northern Pintail ducks (4))
      Posterior distribution
                                                             I
                                               N!     λN
           π(α, N |, n1 , . . . , nI )   ∝                        (1 + eαi )−N
                                             (N − r)! N !
                                                            i=1
                                              I
                                                                   1
                                                   exp αi ni −         (αi − µi )2
                                                                  2σ 2
                                             i=1
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




      Example (Northern Pintail ducks (5))
      For the conditional posterior distribution

                                                         1
      π(αi |N, n1 , . . . , nI ) ∝ exp αi ni −               (αi − µi )2    (1+eαi )N ,
                                                        2σ 2

      the ARS algorithm can be implemented since
                                        1
                             αi ni −        (αi − µi )2 − N log(1 + eαi )
                                       2σ 2
      is concave in αi .
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




               Posterior distributions of capture log-odds ratios for the
                                    years 1957–1965.
                                1957                                           1958                                           1959
         1.0




                                                        1.0




                                                                                                       1.0
         0.8




                                                        0.8




                                                                                                       0.8
         0.6




                                                        0.6




                                                                                                       0.6
         0.4




                                                        0.4




                                                                                                       0.4
         0.2




                                                        0.2




                                                                                                       0.2
         0.0




                                                        0.0




                                                                                                       0.0
               −10   −9   −8   −7   −6   −5   −4   −3         −10   −9   −8   −7   −6   −5   −4   −3         −10   −9   −8   −7   −6   −5   −4   −3


                                1960                                           1961                                           1962
         1.0




                                                        1.0




                                                                                                       1.0
         0.8




                                                        0.8




                                                                                                       0.8
         0.6




                                                        0.6




                                                                                                       0.6
         0.4




                                                        0.4




                                                                                                       0.4
         0.2




                                                        0.2




                                                                                                       0.2
         0.0




                                                        0.0




                                                                                                       0.0
               −10   −9   −8   −7   −6   −5   −4   −3         −10   −9   −8   −7   −6   −5   −4   −3         −10   −9   −8   −7   −6   −5   −4   −3


                                1963                                           1964                                           1965
         1.0




                                                        1.0




                                                                                                       1.0
         0.8




                                                        0.8




                                                                                                       0.8
         0.6




                                                        0.6




                                                                                                       0.6
         0.4




                                                        0.4




                                                                                                       0.4
         0.2




                                                        0.2




                                                                                                       0.2
         0.0




                                                        0.0




               −10   −9   −8   −7   −6   −5   −4   −3         −10   −9   −8   −7   −6   −5   −4   −3   0.0   −10   −9   −8   −7   −6   −5   −4   −3
Markov Chain Monte Carlo Methods
  Random variable generation
     Log-concave densities




                                                                          True
                                         1960
           0.8
           0.6
           0.4
           0.2
           0.0




                 −8                −7     −6           −5            −4




                 distribution versus histogram of simulated sample
Markov Chain Monte Carlo Methods
  Monte Carlo Integration




Monte Carlo integration
      Motivation and leading example

      Random variable generation

      Monte Carlo Integration
        Introduction
        Monte Carlo integration
        Importance Sampling
        Acceleration methods
        Bayesian importance sampling

      Notions on Markov Chains

      The Metropolis-Hastings Algorithm
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Introduction



Quick reminder



      Two major classes of numerical problems that arise in statistical
      inference
          ◦ Optimization - generally associated with the likelihood
            approach
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Introduction



Quick reminder



      Two major classes of numerical problems that arise in statistical
      inference
          ◦ Optimization - generally associated with the likelihood
            approach

          ◦ Integration- generally associated with the Bayesian approach
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Introduction


                                                                         skip Example!


      Example (Bayesian decision theory)
      Bayes estimators are not always posterior expectations, but rather
      solutions of the minimization problem

                                   min       L(θ, δ) π(θ) f (x|θ) dθ .
                                    δ    Θ

      Proper loss:
      For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Introduction


                                                                         skip Example!


      Example (Bayesian decision theory)
      Bayes estimators are not always posterior expectations, but rather
      solutions of the minimization problem

                                   min       L(θ, δ) π(θ) f (x|θ) dθ .
                                    δ    Θ

      Proper loss:
      For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean
      Absolute error loss:
      For L(θ, δ) = |θ − δ|, the Bayes estimator is the posterior median
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Introduction


                                                                         skip Example!


      Example (Bayesian decision theory)
      Bayes estimators are not always posterior expectations, but rather
      solutions of the minimization problem

                                   min       L(θ, δ) π(θ) f (x|θ) dθ .
                                    δ    Θ

      Proper loss:
      For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean
      Absolute error loss:
      For L(θ, δ) = |θ − δ|, the Bayes estimator is the posterior median
      With no loss function
      use the maximum a posteriori (MAP) estimator

                                         arg max ℓ(θ|x)π(θ)
                                                θ
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration



Monte Carlo integration



      Theme:
      Generic problem of evaluating the integral

                               I = Ef [h(X)] =       h(x) f (x) dx
                                                 X

      where X is uni- or multidimensional, f is a closed form, partly
      closed form, or implicit density, and h is a function
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration



Monte Carlo integration (2)


      Monte Carlo solution
      First use a sample (X1 , . . . , Xm ) from the density f to
      approximate the integral I by the empirical average
                                              m
                                          1
                                   hm =             h(xj )
                                          m
                                              j=1
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration



Monte Carlo integration (2)


      Monte Carlo solution
      First use a sample (X1 , . . . , Xm ) from the density f to
      approximate the integral I by the empirical average
                                              m
                                          1
                                   hm =             h(xj )
                                          m
                                              j=1

      which converges
                                   hm −→ Ef [h(X)]
      by the Strong Law of Large Numbers
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration



Monte Carlo precision

      Estimate the variance with
                                               m
                                      1 1
                               vm =                 [h(xj ) − hm ]2 ,
                                      mm−1
                                              j=1

      and for m large,

                                   hm − Ef [h(X)]
                                       √          ∼ N (0, 1).
                                         vm

      Note: This can lead to the construction of a convergence test and
      of confidence bounds on the approximation of Ef [h(X)].
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration




      Example (Cauchy prior/normal sample)
      For estimating a normal mean, a robust prior is a Cauchy prior

                                   X ∼ N (θ, 1),     θ ∼ C(0, 1).

      Under squared error loss, posterior mean
                                           ∞
                                                  θ           2
                                                     2
                                                       e−(x−θ) /2 dθ
                                           −∞   1+θ
                               δ π (x) =    ∞
                                                  1           2
                                                       e−(x−θ) /2 dθ
                                           −∞   1 + θ2
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration




      Example (Cauchy prior/normal sample (2))
      Form of δ π suggests simulating iid variables

                                      θ1 , · · · , θm ∼ N (x, 1)

      and calculating
                                          m               m
                               ˆπ                 θi             1
                               δm (x) =              2              2 .
                                          i=1
                                                1 + θi   i=1
                                                               1 + θi

      The Law of Large Numbers implies
                                   ˆπ
                                   δm (x) −→ δ π (x) as m −→ ∞.
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Monte Carlo integration




                                                                           Ran
          10.6
          10.4
          10.2
          10.0
          9.8
          9.6




                 0             200   400                600   800   1000

                                           iterations
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Importance sampling


      Paradox
      Simulation from f (the true density) is not necessarily optimal
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Importance sampling


      Paradox
      Simulation from f (the true density) is not necessarily optimal

      Alternative to direct sampling from f is importance sampling,
      based on the alternative representation

                                                     f (x)
                            Ef [h(X)] =       h(x)           g(x) dx .
                                          X          g(x)

      which allows us to use other distributions than f
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Importance sampling algorithm

          Evaluation of

                             Ef [h(X)] =         h(x) f (x) dx
                                             X

          by
            1. Generate a sample X1 , . . . , Xn from a distribution g
            2. Use the approximation
                                       m
                                   1         f (Xj )
                                                     h(Xj )
                                   m         g(Xj )
                                       j=1
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Same thing as before!!!



      Convergence of the estimator
                             m
                        1          f (Xj )
                                           h(Xj ) −→       h(x) f (x) dx
                        m          g(Xj )              X
                            j=1
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Same thing as before!!!



      Convergence of the estimator
                             m
                        1          f (Xj )
                                           h(Xj ) −→       h(x) f (x) dx
                        m          g(Xj )              X
                            j=1


      converges for any choice of the distribution g
      [as long as supp(g) ⊃ supp(f )]
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Important details



          ◦ Instrumental distribution g chosen from distributions easy to
            simulate
          ◦ The same sample (generated from g) can be used repeatedly,
            not only for different functions h, but also for different
            densities f
          ◦ Even dependent proposals can be used, as seen later
                 PMC chapter
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Although g can be any density, some choices are better than
      others:
          ◦ Finite variance only when

                                       f (X)                  f 2 (X)
                           Ef h2 (X)         =       h2 (x)           dx < ∞ .
                                       g(X)      X             g(X)
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Although g can be any density, some choices are better than
      others:
          ◦ Finite variance only when

                                       f (X)                  f 2 (X)
                           Ef h2 (X)         =       h2 (x)           dx < ∞ .
                                       g(X)      X             g(X)

          ◦ Instrumental distributions with tails lighter than those of f
            (that is, with sup f /g = ∞) not appropriate.
          ◦ If sup f /g = ∞, the weights f (xj )/g(xj ) vary widely, giving
            too much importance to a few values xj .
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Although g can be any density, some choices are better than
      others:
          ◦ Finite variance only when

                                       f (X)                  f 2 (X)
                           Ef h2 (X)         =       h2 (x)           dx < ∞ .
                                       g(X)      X             g(X)

          ◦ Instrumental distributions with tails lighter than those of f
            (that is, with sup f /g = ∞) not appropriate.
          ◦ If sup f /g = ∞, the weights f (xj )/g(xj ) vary widely, giving
            too much importance to a few values xj .
          ◦ If sup f /g = M < ∞, the accept-reject algorithm can be used
            as well to simulate f directly.
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Cauchy target)
      Case of Cauchy distribution C(0, 1) when importance function is
      Gaussian N (0, 1).
      Ratio of the densities
                                            p⋆ (x) √     exp x2 /2
                                   ̺(x) =          = 2π
                                            p0 (x)      π (1 + x2 )

      very badly behaved: e.g.,
                                        ∞
                                            ̺(x)2 p0 (x)dx = ∞ .
                                       −∞

      Poor performances of the associated importance sampling
      estimator
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



            200
            150
            100
            50
            0




                   0               2000   4000                6000   8000   10000

                                                 iterations
                                                                Range
      and average of 500 replications of IS estimate of E[exp −X]
      over 10, 000 iterations.
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Optimal importance function



      The choice of g that minimizes the variance of the
      importance sampling estimator is

                                                   |h(x)| f (x)
                                   g ∗ (x) =                        .
                                               Z    |h(z)| f (z) dz
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Optimal importance function



      The choice of g that minimizes the variance of the
      importance sampling estimator is

                                                   |h(x)| f (x)
                                   g ∗ (x) =                        .
                                               Z    |h(z)| f (z) dz

      Rather formal optimality result since optimal choice of g ∗ (x)
      requires the knowledge of I, the integral of interest!
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Practical impact
                                   m
                                   j=1   h(Xj ) f (Xj )/g(Xj )
                                         m                       ,
                                         j=1   f (Xj )/g(Xj )
      where f and g are known up to constants.
          ◦ Also converges to I by the Strong Law of Large Numbers.
          ◦ Biased, but the bias is quite small
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Practical impact
                                   m
                                   j=1   h(Xj ) f (Xj )/g(Xj )
                                         m                       ,
                                         j=1   f (Xj )/g(Xj )
      where f and g are known up to constants.
          ◦ Also converges to I by the Strong Law of Large Numbers.
          ◦ Biased, but the bias is quite small
          ◦ In some settings beats the unbiased estimator in squared error
            loss.
          ◦ Using the ‘optimal’ solution does not always work:
                  m
                  j=1 h(xj ) f (xj )/|h(xj )| f (xj )       #positive h − #negative h
                     m                                  =           m
                     j=1 f (xj )/|h(xj )| f (xj )                   j=1 1/|h(xj )|
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Selfnormalised importance sampling


      For ratio estimator
                                           n                 n
                                     n
                                    δh =         ωi h(xi )         ωi
                                           i=1               i=1

      with Xi ∼ g(y) and Wi such that

                                   E[Wi |Xi = x] = κf (x)/g(x)
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



Selfnormalised variance

      then

           n             1
      var(δh ) ≈              var(Sh ) − 2Eπ [h] cov(Sh , S1 ) + Eπ [h]2 var(S1 ) .
                                   n                  n    n                  n
                        n2 κ2
      for
                                      n                         n
                               n                          n
                              Sh =         Wi h(Xi ) ,   S1 =         Wi
                                     i=1                        i=1


      Rough approximation
                                n     1
                            varδh ≈     varπ (h(X)) {1 + varg (W )}
                                      n
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Student’s t distribution)
      X ∼ T (ν, θ, σ 2 ), with density
                                                                   −(ν+1)/2
                             Γ((ν + 1)/2)              (x − θ)2
                    fν (x) = √                    1+                          .
                            σ νπ Γ(ν/2)                  νσ 2

      Without loss of generality, take θ = 0, σ = 1.
      Problem: Calculate the integral
                                    ∞              n
                                         sin(x)
                                                       fν (x)dx.
                                   2.1      x
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Student’s t distribution (2))
          • Simulation possibilities
                  ◦ Directly from fν , since fν = N (0,1)
                                                   √ 2
                                                     χν
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Student’s t distribution (2))
          • Simulation possibilities
                  ◦ Directly from fν , since fν = N (0,1)
                                                   √ 2
                                                     χν
                  ◦ Importance sampling using Cauchy C (0, 1)
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Student’s t distribution (2))
          • Simulation possibilities
                  ◦ Directly from fν , since fν = N (0,1)
                                                   √ 2
                                                     χν
                  ◦ Importance sampling using Cauchy C (0, 1)
                  ◦ Importance sampling using a normal N (0, 1)
                    (expected to be nonoptimal)
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




      Example (Student’s t distribution (2))
          • Simulation possibilities
                  ◦ Directly from fν , since fν = N (0,1)
                                                   √ 2
                                                     χν
                  ◦ Importance sampling using Cauchy C (0, 1)
                  ◦ Importance sampling using a normal N (0, 1)
                    (expected to be nonoptimal)
                  ◦ Importance sampling using a U ([0, 1/2.1])
                    change of variables
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling




                                                                    Sampling
      7.0
      6.5
      6.0
      5.5
      5.0




            0               10000   20000   30000   40000   50000

      from f (solid lines), importance sampling with Cauchy
      instrumental (short dashes), U ([0, 1/2.1]) instrumental (long
      dashes) and normal instrumental (dots).
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



IS suffers from curse of dimensionality
      As dimension increases, discrepancy between importance and
      target worsens
                                                            skip explanation
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



IS suffers from curse of dimensionality
      As dimension increases, discrepancy between importance and
      target worsens
                                                                                     skip explanation

      Explanation:
      Take target distribution µ and instrumental distribution ν       N
      Simulation of a sample of iid samples of size n x1:n from µn = µ n
      Importance sampling estimator for µn (fn ) = fn (x1:n )µn (dx1:n )
                                                 N          i        N
                                                 i=1   fn (ξ1:n )    j=1   Wji
                                   µn (fn ) =          N       N
                                                                                 ,
                                                       j=1     j=1   Wj

      where Wk = dµ (ξk ), and ξj are iid with distribution ν.
               i
                    dν
                         i        i

      For {Vk }k≥0 , sequence of iid nonnegative random variables and for
      n ≥ 1, Fn = σ(Vk ; k ≤ n), set
                                                         n
                                                Un =          Vk
                                                        k=1
Markov Chain Monte Carlo Methods
  Monte Carlo Integration
     Importance Sampling



IS suffers (2)
      Since E[Vn+1 ] = 1 and Vn+1 independent from Fn ,

                             E(Un+1 | Fn ) = Un E(Vn+1 | Fn ) = Un ,

      and thus {Un }n≥0 martingale
                √
      Since x → x concave, by Jensen’s inequality,

                  E( Un+1 | Fn ) ≤ E(Un+1 | Fn ) ≤                      Un
                √
      and thus { Un }n≥0 supermartingale
      Assume E( Vn+1 ) < 1. Then
                                            n
                            E(     Un ) =         E(   Vk ) → 0,   n → ∞.
                                            k=1
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods
Monte Carlo Statistical Methods

More Related Content

What's hot

What's hot (20)

Poisson lecture
Poisson lecturePoisson lecture
Poisson lecture
 
Bernoullis Random Variables And Binomial Distribution
Bernoullis Random Variables And Binomial DistributionBernoullis Random Variables And Binomial Distribution
Bernoullis Random Variables And Binomial Distribution
 
Binomial distribution
Binomial distributionBinomial distribution
Binomial distribution
 
Point estimation.pptx
Point estimation.pptxPoint estimation.pptx
Point estimation.pptx
 
Goodness of Fit Notation
Goodness of Fit NotationGoodness of Fit Notation
Goodness of Fit Notation
 
Bias and Mean square error
Bias and Mean square errorBias and Mean square error
Bias and Mean square error
 
Inference about means and mean differences
Inference about means and mean differencesInference about means and mean differences
Inference about means and mean differences
 
Probability
Probability    Probability
Probability
 
Les5e ppt 05
Les5e ppt 05Les5e ppt 05
Les5e ppt 05
 
Two Means, Independent Samples
Two Means, Independent SamplesTwo Means, Independent Samples
Two Means, Independent Samples
 
Probability
ProbabilityProbability
Probability
 
Transformation of random variables
Transformation of random variablesTransformation of random variables
Transformation of random variables
 
Random Variables and Distributions
Random Variables and DistributionsRandom Variables and Distributions
Random Variables and Distributions
 
Practice Test 2 Probability
Practice Test 2 ProbabilityPractice Test 2 Probability
Practice Test 2 Probability
 
Practice Test 1 solutions
Practice Test 1 solutions  Practice Test 1 solutions
Practice Test 1 solutions
 
Metropolis-Hastings MCMC Short Tutorial
Metropolis-Hastings MCMC Short TutorialMetropolis-Hastings MCMC Short Tutorial
Metropolis-Hastings MCMC Short Tutorial
 
Analisis komponen utama (Principal Component Analysis)
Analisis komponen utama (Principal Component Analysis)Analisis komponen utama (Principal Component Analysis)
Analisis komponen utama (Principal Component Analysis)
 
introduction to statistical theory
introduction to statistical theoryintroduction to statistical theory
introduction to statistical theory
 
Estimation in statistics
Estimation in statisticsEstimation in statistics
Estimation in statistics
 
Hypergeometric probability distribution
Hypergeometric probability distributionHypergeometric probability distribution
Hypergeometric probability distribution
 

Viewers also liked

Introducing Monte Carlo Methods with R
Introducing Monte Carlo Methods with RIntroducing Monte Carlo Methods with R
Introducing Monte Carlo Methods with R
Christian Robert
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating Access
Aram SE
 
Lecture1
Lecture1Lecture1
Lecture1
rjaeh
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
Aram SE
 
Communication skills in english
Communication skills in englishCommunication skills in english
Communication skills in english
Aqib Memon
 
Database and Access Power Point
Database and Access Power PointDatabase and Access Power Point
Database and Access Power Point
Ayee_Its_Bailey
 
01 computer%20 forensics%20in%20todays%20world
01 computer%20 forensics%20in%20todays%20world01 computer%20 forensics%20in%20todays%20world
01 computer%20 forensics%20in%20todays%20world
Aqib Memon
 
Computer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows RegistryComputer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows Registry
aradhanalaw
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
Aram SE
 
Access lesson05
Access lesson05Access lesson05
Access lesson05
Aram SE
 

Viewers also liked (20)

Introducing Monte Carlo Methods with R
Introducing Monte Carlo Methods with RIntroducing Monte Carlo Methods with R
Introducing Monte Carlo Methods with R
 
OWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security SessionOWASP Khartoum Cyber Security Session
OWASP Khartoum Cyber Security Session
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating Access
 
Monte Carlo Simulation
Monte Carlo SimulationMonte Carlo Simulation
Monte Carlo Simulation
 
Lecture1
Lecture1Lecture1
Lecture1
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
 
Communication skills in english
Communication skills in englishCommunication skills in english
Communication skills in english
 
Database and Access Power Point
Database and Access Power PointDatabase and Access Power Point
Database and Access Power Point
 
Monte Carlo G P U Jan2010
Monte  Carlo  G P U  Jan2010Monte  Carlo  G P U  Jan2010
Monte Carlo G P U Jan2010
 
01 computer%20 forensics%20in%20todays%20world
01 computer%20 forensics%20in%20todays%20world01 computer%20 forensics%20in%20todays%20world
01 computer%20 forensics%20in%20todays%20world
 
Model inquiri
Model inquiriModel inquiri
Model inquiri
 
Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010
 
Computer Forensics
Computer ForensicsComputer Forensics
Computer Forensics
 
Computer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows RegistryComputer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows Registry
 
Super Efficient Monte Carlo Simulation
Super Efficient Monte Carlo SimulationSuper Efficient Monte Carlo Simulation
Super Efficient Monte Carlo Simulation
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
 
Access lesson05
Access lesson05Access lesson05
Access lesson05
 
Unit 5 general principles, simulation software
Unit 5 general principles, simulation softwareUnit 5 general principles, simulation software
Unit 5 general principles, simulation software
 
Agape explains the importance Of Computer Forensics.
Agape explains the importance Of Computer Forensics.Agape explains the importance Of Computer Forensics.
Agape explains the importance Of Computer Forensics.
 
Hemolytic anaemia
Hemolytic anaemiaHemolytic anaemia
Hemolytic anaemia
 

Similar to Monte Carlo Statistical Methods

Introduction to advanced Monte Carlo methods
Introduction to advanced Monte Carlo methodsIntroduction to advanced Monte Carlo methods
Introduction to advanced Monte Carlo methods
Christian Robert
 
Ml mle_bayes
Ml  mle_bayesMl  mle_bayes
Ml mle_bayes
Phong Vo
 
Conditional Random Fields
Conditional Random FieldsConditional Random Fields
Conditional Random Fields
lswing
 
Mcmc & lkd free I
Mcmc & lkd free IMcmc & lkd free I
Mcmc & lkd free I
Deb Roy
 

Similar to Monte Carlo Statistical Methods (20)

Monte Carlo Statistical Methods
Monte Carlo Statistical MethodsMonte Carlo Statistical Methods
Monte Carlo Statistical Methods
 
WSC 2011, advanced tutorial on simulation in Statistics
WSC 2011, advanced tutorial on simulation in StatisticsWSC 2011, advanced tutorial on simulation in Statistics
WSC 2011, advanced tutorial on simulation in Statistics
 
MCMC and likelihood-free methods
MCMC and likelihood-free methodsMCMC and likelihood-free methods
MCMC and likelihood-free methods
 
Introduction to advanced Monte Carlo methods
Introduction to advanced Monte Carlo methodsIntroduction to advanced Monte Carlo methods
Introduction to advanced Monte Carlo methods
 
short course at CIRM, Bayesian Masterclass, October 2018
short course at CIRM, Bayesian Masterclass, October 2018short course at CIRM, Bayesian Masterclass, October 2018
short course at CIRM, Bayesian Masterclass, October 2018
 
RSS Read Paper by Mark Girolami
RSS Read Paper by Mark GirolamiRSS Read Paper by Mark Girolami
RSS Read Paper by Mark Girolami
 
Mark Girolami's Read Paper 2010
Mark Girolami's Read Paper 2010Mark Girolami's Read Paper 2010
Mark Girolami's Read Paper 2010
 
Ml mle_bayes
Ml  mle_bayesMl  mle_bayes
Ml mle_bayes
 
Conditional Random Fields
Conditional Random FieldsConditional Random Fields
Conditional Random Fields
 
Jere Koskela slides
Jere Koskela slidesJere Koskela slides
Jere Koskela slides
 
Introduction to MCMC methods
Introduction to MCMC methodsIntroduction to MCMC methods
Introduction to MCMC methods
 
A bit about мcmc
A bit about мcmcA bit about мcmc
A bit about мcmc
 
Cuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionCuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An Introduction
 
從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論
 
Basics of probability in statistical simulation and stochastic programming
Basics of probability in statistical simulation and stochastic programmingBasics of probability in statistical simulation and stochastic programming
Basics of probability in statistical simulation and stochastic programming
 
Hidden Markov Models
Hidden Markov ModelsHidden Markov Models
Hidden Markov Models
 
Mcmc & lkd free I
Mcmc & lkd free IMcmc & lkd free I
Mcmc & lkd free I
 
Monash University short course, part I
Monash University short course, part IMonash University short course, part I
Monash University short course, part I
 
Pres metabief2020jmm
Pres metabief2020jmmPres metabief2020jmm
Pres metabief2020jmm
 
Bayesian Subset Simulation
Bayesian Subset SimulationBayesian Subset Simulation
Bayesian Subset Simulation
 

More from Christian Robert

More from Christian Robert (20)

Asymptotics of ABC, lecture, Collège de France
Asymptotics of ABC, lecture, Collège de FranceAsymptotics of ABC, lecture, Collège de France
Asymptotics of ABC, lecture, Collège de France
 
Workshop in honour of Don Poskitt and Gael Martin
Workshop in honour of Don Poskitt and Gael MartinWorkshop in honour of Don Poskitt and Gael Martin
Workshop in honour of Don Poskitt and Gael Martin
 
discussion of ICML23.pdf
discussion of ICML23.pdfdiscussion of ICML23.pdf
discussion of ICML23.pdf
 
How many components in a mixture?
How many components in a mixture?How many components in a mixture?
How many components in a mixture?
 
restore.pdf
restore.pdfrestore.pdf
restore.pdf
 
Testing for mixtures at BNP 13
Testing for mixtures at BNP 13Testing for mixtures at BNP 13
Testing for mixtures at BNP 13
 
Inferring the number of components: dream or reality?
Inferring the number of components: dream or reality?Inferring the number of components: dream or reality?
Inferring the number of components: dream or reality?
 
CDT 22 slides.pdf
CDT 22 slides.pdfCDT 22 slides.pdf
CDT 22 slides.pdf
 
Testing for mixtures by seeking components
Testing for mixtures by seeking componentsTesting for mixtures by seeking components
Testing for mixtures by seeking components
 
discussion on Bayesian restricted likelihood
discussion on Bayesian restricted likelihooddiscussion on Bayesian restricted likelihood
discussion on Bayesian restricted likelihood
 
NCE, GANs & VAEs (and maybe BAC)
NCE, GANs & VAEs (and maybe BAC)NCE, GANs & VAEs (and maybe BAC)
NCE, GANs & VAEs (and maybe BAC)
 
ABC-Gibbs
ABC-GibbsABC-Gibbs
ABC-Gibbs
 
Coordinate sampler : A non-reversible Gibbs-like sampler
Coordinate sampler : A non-reversible Gibbs-like samplerCoordinate sampler : A non-reversible Gibbs-like sampler
Coordinate sampler : A non-reversible Gibbs-like sampler
 
eugenics and statistics
eugenics and statisticseugenics and statistics
eugenics and statistics
 
Laplace's Demon: seminar #1
Laplace's Demon: seminar #1Laplace's Demon: seminar #1
Laplace's Demon: seminar #1
 
ABC-Gibbs
ABC-GibbsABC-Gibbs
ABC-Gibbs
 
asymptotics of ABC
asymptotics of ABCasymptotics of ABC
asymptotics of ABC
 
ABC-Gibbs
ABC-GibbsABC-Gibbs
ABC-Gibbs
 
Likelihood-free Design: a discussion
Likelihood-free Design: a discussionLikelihood-free Design: a discussion
Likelihood-free Design: a discussion
 
the ABC of ABC
the ABC of ABCthe ABC of ABC
the ABC of ABC
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Monte Carlo Statistical Methods

  • 1. Markov Chain Monte Carlo Methods Markov Chain Monte Carlo Methods Christian P. Robert Universit´ Paris Dauphine and CREST-INSEE e http://www.ceremade.dauphine.fr/~xian November 9, 2009
  • 2. Markov Chain Monte Carlo Methods Outline Motivation and leading example Random variable generation Monte Carlo Integration Notions on Markov Chains The Metropolis-Hastings Algorithm The Gibbs Sampler MCMC tools for variable dimension problems Sequential importance sampling
  • 3. Markov Chain Monte Carlo Methods New [2004] edition:
  • 4. Markov Chain Monte Carlo Methods Motivation and leading example Motivation and leading example Motivation and leading example Introduction Likelihood methods Missing variable models Bayesian Methods Bayesian troubles Random variable generation Monte Carlo Integration Notions on Markov Chains The Metropolis-Hastings Algorithm
  • 5. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Latent structures make life harder! Even simple models may lead to computational complications, as in latent variable models f (x|θ) = f ⋆ (x, x⋆ |θ) dx⋆
  • 6. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Latent structures make life harder! Even simple models may lead to computational complications, as in latent variable models f (x|θ) = f ⋆ (x, x⋆ |θ) dx⋆ If (x, x⋆ ) observed, fine!
  • 7. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Latent structures make life harder! Even simple models may lead to computational complications, as in latent variable models f (x|θ) = f ⋆ (x, x⋆ |θ) dx⋆ If (x, x⋆ ) observed, fine! If only x observed, trouble!
  • 8. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Example (Mixture models) Models of mixtures of distributions: X ∼ fj with probability pj , for j = 1, 2, . . . , k, with overall density X ∼ p1 f1 (x) + · · · + pk fk (x) .
  • 9. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Example (Mixture models) Models of mixtures of distributions: X ∼ fj with probability pj , for j = 1, 2, . . . , k, with overall density X ∼ p1 f1 (x) + · · · + pk fk (x) . For a sample of independent random variables (X1 , · · · , Xn ), sample density n {p1 f1 (xi ) + · · · + pk fk (xi )} . i=1
  • 10. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Example (Mixture models) Models of mixtures of distributions: X ∼ fj with probability pj , for j = 1, 2, . . . , k, with overall density X ∼ p1 f1 (x) + · · · + pk fk (x) . For a sample of independent random variables (X1 , · · · , Xn ), sample density n {p1 f1 (xi ) + · · · + pk fk (xi )} . i=1 Expanding this product involves k n elementary terms: prohibitive to compute in large samples.
  • 11. Markov Chain Monte Carlo Methods Motivation and leading example Introduction Cas 3 2 µ2 1 0 −1 −1 0 1 2 3 µ1
  • 12. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Maximum likelihood methods Go Bayes!! ◦ For an iid sample X1 , . . . , Xn from a population with density f (x|θ1 , . . . , θk ), the likelihood function is L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn ) n = f (xi |θ1 , . . . , θk ). i=1
  • 13. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Maximum likelihood methods Go Bayes!! ◦ For an iid sample X1 , . . . , Xn from a population with density f (x|θ1 , . . . , θk ), the likelihood function is L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn ) n = f (xi |θ1 , . . . , θk ). i=1 ◦ Global justifications from asymptotics
  • 14. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Maximum likelihood methods Go Bayes!! ◦ For an iid sample X1 , . . . , Xn from a population with density f (x|θ1 , . . . , θk ), the likelihood function is L(θ|x) = L(θ1 , . . . , θk |x1 , . . . , xn ) n = f (xi |θ1 , . . . , θk ). i=1 ◦ Global justifications from asymptotics ◦ Computational difficulty depends on structure, eg latent variables
  • 15. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Example (Mixtures again) For a mixture of two normal distributions, pN (µ, τ 2 ) + (1 − p)N (θ, σ 2 ) , likelihood proportional to n xi − µ xi − θ pτ −1 ϕ + (1 − p) σ −1 ϕ τ σ i=1 containing 2n terms.
  • 16. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Standard maximization techniques often fail to find the global maximum because of multimodality of the likelihood function. Example In the special case ǫ f (x|µ, σ) = (1 − ǫ) exp{(−1/2)x2 } + exp{(−1/2σ 2 )(x − µ)2 } σ (1) with ǫ > 0 known,
  • 17. Markov Chain Monte Carlo Methods Motivation and leading example Likelihood methods Standard maximization techniques often fail to find the global maximum because of multimodality of the likelihood function. Example In the special case ǫ f (x|µ, σ) = (1 − ǫ) exp{(−1/2)x2 } + exp{(−1/2σ 2 )(x − µ)2 } σ (1) with ǫ > 0 known, whatever n, the likelihood is unbounded: lim ℓ(µ = x1 , σ|x1 , . . . , xn ) = ∞ σ→0
  • 18. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models The special case of missing variable models Consider again a latent variable representation g(x|θ) = f (x, z|θ) dz Z
  • 19. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models The special case of missing variable models Consider again a latent variable representation g(x|θ) = f (x, z|θ) dz Z Define the completed (but unobserved) likelihood Lc (θ|x, z) = f (x, z|θ)
  • 20. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models The special case of missing variable models Consider again a latent variable representation g(x|θ) = f (x, z|θ) dz Z Define the completed (but unobserved) likelihood Lc (θ|x, z) = f (x, z|θ) Useful for optimisation algorithm
  • 21. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models The EM Algorithm Gibbs connection Bayes rather than EM Algorithm (Expectation–Maximisation) Iterate (in m) 1. (E step) Compute ˆ ˆ Q(θ|θ(m) , x) = E[log Lc (θ|x, Z)|θ(m) , x] ,
  • 22. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models The EM Algorithm Gibbs connection Bayes rather than EM Algorithm (Expectation–Maximisation) Iterate (in m) 1. (E step) Compute ˆ ˆ Q(θ|θ(m) , x) = E[log Lc (θ|x, Z)|θ(m) , x] , ˆ 2. (M step) Maximise Q(θ|θ(m) , x) in θ and take ˆ ˆ θ(m+1) = arg max Q(θ|θ(m) , x). θ until a fixed point [of Q] is reached
  • 23. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models Echantillon N(0,1) 0.6 0.5 0.4 0.3 0.2 0.1 0.0 −2 −1 0 1 2
  • 24. Markov Chain Monte Carlo Methods Motivation and leading example Missing variable models Likeli 3 2 µ2 1 0 −1 −1 0 1 2 3 µ1
  • 25. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods The Bayesian Perspective In the Bayesian paradigm, the information brought by the data x, realization of X ∼ f (x|θ),
  • 26. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods The Bayesian Perspective In the Bayesian paradigm, the information brought by the data x, realization of X ∼ f (x|θ), is combined with prior information specified by prior distribution with density π(θ)
  • 27. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool Summary in a probability distribution, π(θ|x), called the posterior distribution
  • 28. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool Summary in a probability distribution, π(θ|x), called the posterior distribution Derived from the joint distribution f (x|θ)π(θ), according to f (x|θ)π(θ) π(θ|x) = , f (x|θ)π(θ)dθ [Bayes Theorem]
  • 29. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool Summary in a probability distribution, π(θ|x), called the posterior distribution Derived from the joint distribution f (x|θ)π(θ), according to f (x|θ)π(θ) π(θ|x) = , f (x|θ)π(θ)dθ [Bayes Theorem] where m(x) = f (x|θ)π(θ)dθ is the marginal density of X
  • 30. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool...central to Bayesian inference Posterior defined up to a constant as π(θ|x) ∝ f (x|θ) π(θ) ◮ Operates conditional upon the observations
  • 31. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool...central to Bayesian inference Posterior defined up to a constant as π(θ|x) ∝ f (x|θ) π(θ) ◮ Operates conditional upon the observations ◮ Integrate simultaneously prior information and information brought by x
  • 32. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool...central to Bayesian inference Posterior defined up to a constant as π(θ|x) ∝ f (x|θ) π(θ) ◮ Operates conditional upon the observations ◮ Integrate simultaneously prior information and information brought by x ◮ Avoids averaging over the unobserved values of x
  • 33. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool...central to Bayesian inference Posterior defined up to a constant as π(θ|x) ∝ f (x|θ) π(θ) ◮ Operates conditional upon the observations ◮ Integrate simultaneously prior information and information brought by x ◮ Avoids averaging over the unobserved values of x ◮ Coherent updating of the information available on θ, independent of the order in which i.i.d. observations are collected
  • 34. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian Methods Central tool...central to Bayesian inference Posterior defined up to a constant as π(θ|x) ∝ f (x|θ) π(θ) ◮ Operates conditional upon the observations ◮ Integrate simultaneously prior information and information brought by x ◮ Avoids averaging over the unobserved values of x ◮ Coherent updating of the information available on θ, independent of the order in which i.i.d. observations are collected ◮ Provides a complete inferential scope and a unique motor of inference
  • 35. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Conjugate bonanza... Example (Binomial) For an observation X ∼ B(n, p) so-called conjugate prior is the family of beta Be(a, b) distributions
  • 36. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Conjugate bonanza... Example (Binomial) For an observation X ∼ B(n, p) so-called conjugate prior is the family of beta Be(a, b) distributions The classical Bayes estimator δ π is the posterior mean 1 Γ(a + b + n) p px+a−1 (1 − p)n−x+b−1 dp Γ(a + x)Γ(n − x + b) 0 x+a = . a+b+n
  • 37. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Normal) In the normal N (µ, σ 2 ) case, with both µ and σ unknown, conjugate prior on θ = (µ, σ 2 ) of the form (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2
  • 38. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Normal) In the normal N (µ, σ 2 ) case, with both µ and σ unknown, conjugate prior on θ = (µ, σ 2 ) of the form (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2 since π((µ, σ 2 )|x1 , . . . , xn ) ∝ (σ 2 )−λσ exp − λµ (µ − ξ)2 + α /σ 2 ×(σ 2 )−n exp − n(µ − x)2 + s2 /σ 2 x ∝ (σ 2 )−λσ +n exp − (λµ + n)(µ − ξx )2 nλµ +α + s2 + x /σ 2 n + λµ
  • 39. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles ...and conjugate curse The use of conjugate priors for computational reasons • implies a restriction on the modeling of the available prior information
  • 40. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles ...and conjugate curse The use of conjugate priors for computational reasons • implies a restriction on the modeling of the available prior information • may be detrimental to the usefulness of the Bayesian approach
  • 41. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles ...and conjugate curse The use of conjugate priors for computational reasons • implies a restriction on the modeling of the available prior information • may be detrimental to the usefulness of the Bayesian approach • gives an impression of subjective manipulation of the prior information disconnected from reality.
  • 42. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles A typology of Bayes computational problems (i). use of a complex parameter space, as for instance in constrained parameter sets like those resulting from imposing stationarity constraints in dynamic models;
  • 43. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles A typology of Bayes computational problems (i). use of a complex parameter space, as for instance in constrained parameter sets like those resulting from imposing stationarity constraints in dynamic models; (ii). use of a complex sampling model with an intractable likelihood, as for instance in missing data and graphical models;
  • 44. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles A typology of Bayes computational problems (i). use of a complex parameter space, as for instance in constrained parameter sets like those resulting from imposing stationarity constraints in dynamic models; (ii). use of a complex sampling model with an intractable likelihood, as for instance in missing data and graphical models; (iii). use of a huge dataset;
  • 45. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles A typology of Bayes computational problems (i). use of a complex parameter space, as for instance in constrained parameter sets like those resulting from imposing stationarity constraints in dynamic models; (ii). use of a complex sampling model with an intractable likelihood, as for instance in missing data and graphical models; (iii). use of a huge dataset; (iv). use of a complex prior distribution (which may be the posterior distribution associated with an earlier sample);
  • 46. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles A typology of Bayes computational problems (i). use of a complex parameter space, as for instance in constrained parameter sets like those resulting from imposing stationarity constraints in dynamic models; (ii). use of a complex sampling model with an intractable likelihood, as for instance in missing data and graphical models; (iii). use of a huge dataset; (iv). use of a complex prior distribution (which may be the posterior distribution associated with an earlier sample); (v). use of a complex inferential procedure as for instance, Bayes factors π P (θ ∈ Θ0 | x) π(θ ∈ Θ0 ) B01 (x) = . P (θ ∈ Θ1 | x) π(θ ∈ Θ1 )
  • 47. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again) Observations from x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 )
  • 48. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again) Observations from x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 ) Prior 2 µi |σi ∼ N (ξi , σi /ni ), 2 σi ∼ I G (νi /2, s2 /2), i p ∼ Be(α, β)
  • 49. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again) Observations from x1 , . . . , xn ∼ f (x|θ) = pϕ(x; µ1 , σ1 ) + (1 − p)ϕ(x; µ2 , σ2 ) Prior 2 µi |σi ∼ N (ξi , σi /ni ), 2 σi ∼ I G (νi /2, s2 /2), i p ∼ Be(α, β) Posterior n π(θ|x1 , . . . , xn ) ∝ {pϕ(xj ; µ1 , σ1 ) + (1 − p)ϕ(xj ; µ2 , σ2 )} π(θ) j=1 n = ω(kt )π(θ|(kt )) ℓ=0 (kt ) n
  • 50. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again (cont’d)) For a given permutation (kt ), conditional posterior distribution 2 σ1 π(θ|(kt )) = N ξ1 (kt ), × I G ((ν1 + ℓ)/2, s1 (kt )/2) n1 + ℓ 2 σ2 ×N ξ2 (kt ), × I G ((ν2 + n − ℓ)/2, s2 (kt )/2) n2 + n − ℓ ×Be(α + ℓ, β + n − ℓ)
  • 51. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again (cont’d)) where 1 ℓ ℓ 2 x1 (kt ) = ¯ ℓ t=1 xkt , s1 (kt ) = ˆ t=1 (xkt − x1 (kt )) , ¯ 1 n n 2 x2 (kt ) = ¯ n−ℓ t=ℓ+1 xkt , s2 (kt ) = ˆ t=ℓ+1 (xkt − x2 (kt )) ¯ and n1 ξ1 + ℓ¯1 (kt ) x n2 ξ2 + (n − ℓ)¯2 (kt ) x ξ1 (kt ) = , ξ2 (kt ) = , n1 + ℓ n2 + n − ℓ n1 ℓ s1 (kt ) = s2 + s2 (kt ) + 1 ˆ1 (ξ1 − x1 (kt ))2 , ¯ n1 + ℓ n2 (n − ℓ) s2 (kt ) = s2 + s2 (kt ) + 2 ˆ2 (ξ2 − x2 (kt ))2 , ¯ n2 + n − ℓ posterior updates of the hyperparameters
  • 52. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Mixture once again) Bayes estimator of θ: n δ π (x1 , . . . , xn ) = ω(kt )Eπ [θ|x, (kt )] ℓ=0 (kt ) Too costly: 2n terms
  • 53. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles press for AR Example (Poly-t priors) Normal observation x ∼ N (θ, 1), with conjugate prior θ ∼ N (µ, ǫ) Closed form expression for the posterior mean θ f (x|θ) π(θ) dθ f (x|θ) π(θ) dθ = Θ Θ x + ǫ−2 µ = . 1 + ǫ−2
  • 54. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Poly-t priors (2)) More involved prior distribution: poly-t distribution [Bauwens,1985] k −νi π(θ) = αi + (θ − βi )2 αi , νi > 0 i=1
  • 55. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (Poly-t priors (2)) More involved prior distribution: poly-t distribution [Bauwens,1985] k −νi π(θ) = αi + (θ − βi )2 αi , νi > 0 i=1 Computation of E[θ|x] ???
  • 56. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (AR(p) model) Auto-regressive representation of a time series, p xt = θi xt−i + σεt i=1
  • 57. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (AR(p) model) Auto-regressive representation of a time series, p xt = θi xt−i + σεt i=1 If order p unknown, predictive distribution of xt+1 given by π(xt+1 |xt , . . . , x1 ) ∝ f (xt+1 |xt , . . . , xt−p+1 )π(θ, p|xt , . . . , x1 )dp dθ ,
  • 58. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (AR(p) model (cont’d)) Integration over the parameters of all models ∞ f (xt+1 |xt , . . . , xt−p+1 )π(θ|p, xt , . . . , x1 ) dθ π(p|xt , . . . , x1 ) . p=0
  • 59. Markov Chain Monte Carlo Methods Motivation and leading example Bayesian troubles Example (AR(p) model (cont’d)) Multiple layers of complexity (i). Complex parameter space within each AR(p) model because of stationarity constraint (ii). if p unbounded, infinity of models (iii). θ varies between models AR(p) and AR(p + 1), with a different stationarity constraint (except for root reparameterisation). (iv). if prediction used sequentially, every tick/second/hour/day, posterior distribution π(θ, p|xt , . . . , x1 ) must be re-evaluated
  • 60. Markov Chain Monte Carlo Methods Random variable generation Random variable generation Motivation and leading example Random variable generation Basic methods Uniform pseudo-random generator Beyond Uniform distributions Transformation methods Accept-Reject Methods Fundamental theorem of simulation Log-concave densities Monte Carlo Integration Notions on Markov Chains
  • 61. Markov Chain Monte Carlo Methods Random variable generation Random variable generation • Rely on the possibility of producing (computer-wise) an endless flow of random variables (usually iid) from well-known distributions
  • 62. Markov Chain Monte Carlo Methods Random variable generation Random variable generation • Rely on the possibility of producing (computer-wise) an endless flow of random variables (usually iid) from well-known distributions • Given a uniform random number generator, illustration of methods that produce random variables from both standard and nonstandard distributions
  • 63. Markov Chain Monte Carlo Methods Random variable generation Basic methods The inverse transform method For a function F on R, the generalized inverse of F , F − , is defined by F − (u) = inf {x; F (x) ≥ u} .
  • 64. Markov Chain Monte Carlo Methods Random variable generation Basic methods The inverse transform method For a function F on R, the generalized inverse of F , F − , is defined by F − (u) = inf {x; F (x) ≥ u} . Definition (Probability Integral Transform) If U ∼ U[0,1] , then the random variable F − (U ) has the distribution F.
  • 65. Markov Chain Monte Carlo Methods Random variable generation Basic methods The inverse transform method (2) To generate a random variable X ∼ F , simply generate U ∼ U[0,1]
  • 66. Markov Chain Monte Carlo Methods Random variable generation Basic methods The inverse transform method (2) To generate a random variable X ∼ F , simply generate U ∼ U[0,1] and then make the transform x = F − (u)
  • 67. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Desiderata and limitations skip Uniform • Production of a deterministic sequence of values in [0, 1] which imitates a sequence of iid uniform random variables U[0,1] .
  • 68. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Desiderata and limitations skip Uniform • Production of a deterministic sequence of values in [0, 1] which imitates a sequence of iid uniform random variables U[0,1] . • Can’t use the physical imitation of a “random draw” [no guarantee of uniformity, no reproducibility]
  • 69. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Desiderata and limitations skip Uniform • Production of a deterministic sequence of values in [0, 1] which imitates a sequence of iid uniform random variables U[0,1] . • Can’t use the physical imitation of a “random draw” [no guarantee of uniformity, no reproducibility] • Random sequence in the sense: Having generated (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts no discernible knowledge of the value of Xn+1 .
  • 70. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Desiderata and limitations skip Uniform • Production of a deterministic sequence of values in [0, 1] which imitates a sequence of iid uniform random variables U[0,1] . • Can’t use the physical imitation of a “random draw” [no guarantee of uniformity, no reproducibility] • Random sequence in the sense: Having generated (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts no discernible knowledge of the value of Xn+1 . • Deterministic: Given the initial value X0 , sample (X1 , · · · , Xn ) always the same
  • 71. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Desiderata and limitations skip Uniform • Production of a deterministic sequence of values in [0, 1] which imitates a sequence of iid uniform random variables U[0,1] . • Can’t use the physical imitation of a “random draw” [no guarantee of uniformity, no reproducibility] • Random sequence in the sense: Having generated (X1 , · · · , Xn ), knowledge of Xn [or of (X1 , · · · , Xn )] imparts no discernible knowledge of the value of Xn+1 . • Deterministic: Given the initial value X0 , sample (X1 , · · · , Xn ) always the same • Validity of a random number generator based on a single sample X1 , · · · , Xn when n tends to +∞, not on replications (X11 , · · · , X1n ), (X21 , · · · , X2n ), . . . (Xk1 , · · · , Xkn ) where n fixed and k tends to infinity.
  • 72. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Uniform pseudo-random generator Algorithm starting from an initial value 0 ≤ u0 ≤ 1 and a transformation D, which produces a sequence (ui ) = (Di (u0 )) in [0, 1].
  • 73. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Uniform pseudo-random generator Algorithm starting from an initial value 0 ≤ u0 ≤ 1 and a transformation D, which produces a sequence (ui ) = (Di (u0 )) in [0, 1]. For all n, (u1 , · · · , un ) reproduces the behavior of an iid U[0,1] sample (V1 , · · · , Vn ) when compared through usual tests
  • 74. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Uniform pseudo-random generator (2) • Validity means the sequence U1 , · · · , Un leads to accept the hypothesis H : U1 , · · · , Un are iid U[0,1] .
  • 75. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Uniform pseudo-random generator (2) • Validity means the sequence U1 , · · · , Un leads to accept the hypothesis H : U1 , · · · , Un are iid U[0,1] . • The set of tests used is generally of some consequence ◦ Kolmogorov–Smirnov and other nonparametric tests ◦ Time series methods, for correlation between Ui and (Ui−1 , · · · , Ui−k ) ◦ Marsaglia’s battery of tests called Die Hard (!)
  • 76. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Usual generators In R and S-plus, procedure runif() The Uniform Distribution Description: ‘runif’ generates random deviates. Example: u <- runif(20) ‘.Random.seed’ is an integer vector, containing the random number generator state for random number generation in R. It can be saved and restored, but should not be altered by users.
  • 77. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator 0.0 0.2 0.4 0.6 0.8 1.0 500 520 540 560 580 600 uniform sample 1.5 1.0 0.5 0.0 0.0 0.2 0.4 0.6 0.8 1.0
  • 78. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Usual generators (2) In C, procedure rand() or random() SYNOPSIS #include <stdlib.h> long int random(void); DESCRIPTION The random() function uses a non-linear additive feedback random number generator employing a default table of size 31 long integers to return successive pseudo-random numbers in the range from 0 to RAND_MAX. The period of this random generator is very large, approximately 16*((2**31)-1). RETURN VALUE random() returns a value between 0 and RAND_MAX.
  • 79. Markov Chain Monte Carlo Methods Random variable generation Uniform pseudo-random generator Usual generators(3) In Scilab, procedure rand() rand() : with no arguments gives a scalar whose value changes each time it is referenced. By default, random numbers are uniformly distributed in the interval (0,1). rand(’normal’) switches to a normal distribution with mean 0 and variance 1. EXAMPLE x=rand(10,10,’uniform’)
  • 80. Markov Chain Monte Carlo Methods Random variable generation Beyond Uniform distributions Beyond Uniform generators • Generation of any sequence of random variables can be formally implemented through a uniform generator ◦ Distributions with explicit F − (for instance, exponential, and Weibull distributions), use the probability integral transform here
  • 81. Markov Chain Monte Carlo Methods Random variable generation Beyond Uniform distributions Beyond Uniform generators • Generation of any sequence of random variables can be formally implemented through a uniform generator ◦ Distributions with explicit F − (for instance, exponential, and Weibull distributions), use the probability integral transform here ◦ Case specific methods rely on properties of the distribution (for instance, normal distribution, Poisson distribution)
  • 82. Markov Chain Monte Carlo Methods Random variable generation Beyond Uniform distributions Beyond Uniform generators • Generation of any sequence of random variables can be formally implemented through a uniform generator ◦ Distributions with explicit F − (for instance, exponential, and Weibull distributions), use the probability integral transform here ◦ Case specific methods rely on properties of the distribution (for instance, normal distribution, Poisson distribution) ◦ More generic methods (for instance, accept-reject and ratio-of-uniform)
  • 83. Markov Chain Monte Carlo Methods Random variable generation Beyond Uniform distributions Beyond Uniform generators • Generation of any sequence of random variables can be formally implemented through a uniform generator ◦ Distributions with explicit F − (for instance, exponential, and Weibull distributions), use the probability integral transform here ◦ Case specific methods rely on properties of the distribution (for instance, normal distribution, Poisson distribution) ◦ More generic methods (for instance, accept-reject and ratio-of-uniform) • Simulation of the standard distributions is accomplished quite efficiently by many numerical and statistical programming packages.
  • 84. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Transformation methods Case where a distribution F is linked in a simple way to another distribution easy to simulate. Example (Exponential variables) If U ∼ U[0,1] , the random variable X = − log U/λ has distribution P (X ≤ x) = P (− log U ≤ λx) = P (U ≥ e−λx ) = 1 − e−λx , the exponential distribution E xp(λ).
  • 85. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Other random variables that can be generated starting from an exponential include ν Y = −2 log(Uj ) ∼ χ2 2ν j=1 a 1 Y =− log(Uj ) ∼ G a(a, β) β j=1 a j=1 log(Uj ) Y = a+b ∼ Be(a, b) j=1 log(Uj )
  • 86. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Points to note ◦ Transformation quite simple to use ◦ There are more efficient algorithms for gamma and beta random variables ◦ Cannot generate gamma random variables with a non-integer shape parameter ◦ For instance, cannot get a χ2 variable, which would get us a 1 N (0, 1) variable.
  • 87. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Box-Muller Algorithm Example (Normal variables) If r, θ polar coordinates of (X1 , X2 ), then, r2 = X1 + X2 ∼ χ2 = E (1/2) 2 2 2 and θ ∼ U [0, 2π]
  • 88. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Box-Muller Algorithm Example (Normal variables) If r, θ polar coordinates of (X1 , X2 ), then, r2 = X1 + X2 ∼ χ2 = E (1/2) 2 2 2 and θ ∼ U [0, 2π] Consequence: If U1 , U2 iid U[0,1] , X1 = −2 log(U1 ) cos(2πU2 ) X2 = −2 log(U1 ) sin(2πU2 ) iid N (0, 1).
  • 89. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Box-Muller Algorithm (2) 1. Generate U1 , U2 iid U[0,1] ; 2. Define x1 = −2 log(u1 ) cos(2πu2 ) , x2 = −2 log(u1 ) sin(2πu2 ) ; 3. Take x1 and x2 as two independent draws from N (0, 1).
  • 90. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Box-Muller Algorithm (3) ◮ Unlike algorithms based on the CLT, 3 this algorithm is exact 2 1 Get two normals for the price of 0 ◮ −1 two uniforms −2 −3 ◮ Drawback (in speed) −4 0.4 −4 −2 0 2 4 in calculating log, cos and sin. 0.3 0.2 0.1 0.0 −4 −2 0 2 4
  • 91. Markov Chain Monte Carlo Methods Random variable generation Transformation methods More transforms Reject Example (Poisson generation) Poisson–exponential connection: If N ∼ P(λ) and Xi ∼ E xp(λ), i ∈ N∗ , Pλ (N = k) = Pλ (X1 + · · · + Xk ≤ 1 < X1 + · · · + Xk+1 ) .
  • 92. Markov Chain Monte Carlo Methods Random variable generation Transformation methods More Poisson Skip Poisson • A Poisson can be simulated by generating Exp(1) till their sum exceeds 1. • This method is simple, but is really practical only for smaller values of λ. • On average, the number of exponential variables required is λ. • Other approaches are more suitable for large λ’s.
  • 93. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Atkinson’s Poisson To generate N ∼ P(λ): 1. Define √ β = π/ 3λ, α = λβ and k = log c−λ−log β; 2. Generate U1 ∼ U[0,1] and calculate x = {α − log{(1 − u1 )/u1 }}/β until x > −0.5 ; 3. Define N = ⌊x + 0.5⌋ and generate U2 ∼ U[0,1] ; 4. Accept N if α−βx+log (u2 /{1+exp(α−βx)}2 ) ≤ k+N log λ−log N ! .
  • 94. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Negative extension ◮ A generator of Poisson random variables can produce negative binomial random variables since, Y ∼ Ga(n, (1 − p)/p) X|y ∼ P(y) implies X ∼ N eg(n, p)
  • 95. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Mixture representation • The representation of the negative binomial is a particular case of a mixture distribution • The principle of a mixture representation is to represent a density f as the marginal of another distribution, for example f (x) = pi fi (x) , i∈Y • If the component distributions fi (x) can be easily generated, X can be obtained by first choosing fi with probability pi and then generating an observation from fi .
  • 96. Markov Chain Monte Carlo Methods Random variable generation Transformation methods Partitioned sampling Special case of mixture sampling when fi (x) = f (x) IAi (x) f (x) dx Ai and pi = Pr(X ∈ Ai ) for a partition (Ai )i
  • 97. Markov Chain Monte Carlo Methods Random variable generation Accept-Reject Methods Accept-Reject algorithm • Many distributions from which it is difficult, or even impossible, to directly simulate. • Another class of methods that only require us to know the functional form of the density f of interest only up to a multiplicative constant. • The key to this method is to use a simpler (simulation-wise) density g, the instrumental density , from which the simulation from the target density f is actually done.
  • 98. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Fundamental theorem of simulation 0.25 Lemma 0.20 Simulating 0.15 X ∼ f (x) f(x) 0.10 equivalent to simulating 0.05 (X, U ) ∼ U{(x, u) : 0 < u < f (x)} 0.00 0 2 4 6 8 10 x
  • 99. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation The Accept-Reject algorithm Given a density of interest f , find a density g and a constant M such that f (x) ≤ M g(x) on the support of f .
  • 100. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation The Accept-Reject algorithm Given a density of interest f , find a density g and a constant M such that f (x) ≤ M g(x) on the support of f . 1. Generate X ∼ g, U ∼ U[0,1] ; 2. Accept Y = X if U ≤ f (X)/M g(X) ; 3. Return to 1. otherwise.
  • 101. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Validation of the Accept-Reject method Warranty: This algorithm produces a variable Y distributed according to f 5 4 3 2 1 0 −4 −2 0 2 4
  • 102. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Two interesting properties ◦ First, it provides a generic method to simulate from any density f that is known up to a multiplicative factor Property particularly important in Bayesian calculations where the posterior distribution π(θ|x) ∝ π(θ) f (x|θ) . is specified up to a normalizing constant
  • 103. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Two interesting properties ◦ First, it provides a generic method to simulate from any density f that is known up to a multiplicative factor Property particularly important in Bayesian calculations where the posterior distribution π(θ|x) ∝ π(θ) f (x|θ) . is specified up to a normalizing constant ◦ Second, the probability of acceptance in the algorithm is 1/M , e.g., expected number of trials until a variable is accepted is M
  • 104. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation More interesting properties ◦ In cases f and g both probability densities, the constant M is necessarily larger that 1.
  • 105. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation More interesting properties ◦ In cases f and g both probability densities, the constant M is necessarily larger that 1. ◦ The size of M , and thus the efficiency of the algorithm, are functions of how closely g can imitate f , especially in the tails
  • 106. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation More interesting properties ◦ In cases f and g both probability densities, the constant M is necessarily larger that 1. ◦ The size of M , and thus the efficiency of the algorithm, are functions of how closely g can imitate f , especially in the tails ◦ For f /g to remain bounded, necessary for g to have tails thicker than those of f . It is therefore impossible to use the A-R algorithm to simulate a Cauchy distribution f using a normal distribution g, however the reverse works quite well.
  • 107. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation No Cauchy! Example (Normal from a Cauchy) Take 1 f (x) = √ exp(−x2 /2) 2π and 1 1 g(x) = , π 1 + x2 densities of the normal and Cauchy distributions.
  • 108. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation No Cauchy! Example (Normal from a Cauchy) Take 1 f (x) = √ exp(−x2 /2) 2π and 1 1 g(x) =, π 1 + x2 densities of the normal and Cauchy distributions. Then f (x) π 2 2π = (1 + x2 ) e−x /2 ≤ = 1.52 g(x) 2 e attained at x = ±1.
  • 109. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Normal from a Cauchy (2)) So probability of acceptance 1/1.52 = 0.66, and, on the average, one out of every three simulated Cauchy variables is rejected.
  • 110. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation No Double! Example (Normal/Double Exponential) Generate a N (0, 1) by using a double-exponential distribution with density g(x|α) = (α/2) exp(−α|x|) Then f (x) 2 −1 −α2 /2 ≤ α e g(x|α) π and minimum of this bound (in α) attained for α⋆ = 1
  • 111. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Normal/Double Exponential (2)) Probability of acceptance π/2e = .76 To produce one normal random variable requires on the average 1/.76 ≈ 1.3 uniform variables.
  • 112. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation truncate Example (Gamma generation) Illustrates a real advantage of the Accept-Reject algorithm The gamma distribution Ga(α, β) represented as the sum of α exponential random variables, only if α is an integer
  • 113. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Gamma generation (2)) Can use the Accept-Reject algorithm with instrumental distribution Ga(a, b), with a = [α], α ≥ 0. (Without loss of generality, β = 1.)
  • 114. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Gamma generation (2)) Can use the Accept-Reject algorithm with instrumental distribution Ga(a, b), with a = [α], α ≥ 0. (Without loss of generality, β = 1.) Up to a normalizing constant, α−a α−a f /gb = b−a xα−a exp{−(1 − b)x} ≤ b−a (1 − b)e for b ≤ 1. The maximum is attained at b = a/α.
  • 115. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Cheng and Feast’s Gamma generator Gamma G a(α, 1), α > 1 distribution 1. Define c1 = α − 1, c2 = (α − (1/6α))/c1 , √ c3 = 2/c1 , c4 = 1 + c3 , and c5 = 1/ α. 2. Repeat generate U1 , U2 take U1 = U2 + c5 (1 − 1.86U1 ) if α > 2.5 until 0 < U1 < 1. 3. Set W = c2 U2 /U1 . 4. If c3 U1 + W + W −1 ≤ c4 or c3 log U1 − log W + W ≤ 1, take c1 W ; otherwise, repeat.
  • 116. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Truncated Normal simulation Example (Truncated Normal distributions) Constraint x ≥ µ produces density proportional to 2 /2σ 2 e−(x−µ) Ix≥µ for a bound µ large compared with µ
  • 117. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Truncated Normal simulation Example (Truncated Normal distributions) Constraint x ≥ µ produces density proportional to 2 /2σ 2 e−(x−µ) Ix≥µ for a bound µ large compared with µ There exists alternatives far superior to the na¨ method of ıve generating a N (µ, σ 2 ) until exceeding µ, which requires an average number of 1/Φ((µ − µ)/σ) simulations from N (µ, σ 2 ) for a single acceptance.
  • 118. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Truncated Normal distributions (2)) Instrumental distribution: translated exponential distribution, E (α, µ), with density gα (z) = αe−α(z−µ) Iz≥µ .
  • 119. Markov Chain Monte Carlo Methods Random variable generation Fundamental theorem of simulation Example (Truncated Normal distributions (2)) Instrumental distribution: translated exponential distribution, E (α, µ), with density gα (z) = αe−α(z−µ) Iz≥µ . The ratio f /gα is bounded by 1/α exp(α2 /2 − αµ) if α > µ , f /gα ≤ 1/α exp(−µ2 /2) otherwise.
  • 120. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Log-concave densities (1) Densities f whose logarithm is concave, for move to next chapter instance Bayesian posterior distributions such that log π(θ|x) = log π(θ) + log f (x|θ) + c concave
  • 121. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Log-concave densities (2) Take Sn = {xi , i = 0, 1, . . . , n + 1} ⊂ supp(f ) such that h(xi ) = log f (xi ) known up to the same constant. By concavity of h, line Li,i+1 through (xi , h(xi )) and (xi+1 , h(xi+1 ))
  • 122. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Log-concave densities (2) Take Sn = {xi , i = 0, 1, . . . , n + 1} ⊂ supp(f ) such that h(xi ) = log f (xi ) known up to the same constant. By concavity of h, line Li,i+1 through (xi , h(xi )) and (xi+1 , h(xi+1 )) ◮ below h in [xi , xi+1 ] and ◮ above this graph outside this interval L 2,3 (x) log f(x) x1 x2 x3 x4 x
  • 123. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Log-concave densities (3) For x ∈ [xi , xi+1 ], if hn (x) = min{Li−1,i (x), Li+1,i+2 (x)} and hn (x) = Li,i+1 (x) , the envelopes are hn (x) ≤ h(x) ≤ hn (x) uniformly on the support of f , with hn (x) = −∞ and hn (x) = min(L0,1 (x), Ln,n+1 (x)) on [x0 , xn+1 ]c .
  • 124. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Log-concave densities (4) Therefore, if f n (x) = exp hn (x) and f n (x) = exp hn (x) then f n (x) ≤ f (x) ≤ f n (x) = ̟n gn (x) , where ̟n normalizing constant of fn
  • 125. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities ARS Algorithm 1. Initialize n and Sn . 2. Generate X ∼ gn (x), U ∼ U[0,1] . 3. If U ≤ f n (X)/̟n gn (X), accept X; otherwise, if U ≤ f (X)/̟n gn (X), accept X
  • 126. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities kill ducks Example (Northern Pintail ducks) Ducks captured at time i with both probability pi and size N of the population unknown. Dataset (n1 , . . . , n11 ) = (32, 20, 8, 5, 1, 2, 0, 2, 1, 1, 0) Number of recoveries over the years 1957–1968 of N = 1612 Northern Pintail ducks banded in 1956
  • 127. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Example (Northern Pintail ducks (2)) Corresponding conditional likelihood I N! L(p1 , . . . , pI |N, n1 , . . . , nI ) = pni (1 − pi )N −ni , i (N − r)! i=1 where I number of captures, ni number of captured animals during the ith capture, and r is the total number of different captured animals.
  • 128. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Example (Northern Pintail ducks (3)) Prior selection If N ∼ P(λ) and pi αi = log ∼ N (µi , σ 2 ), 1 − pi [Normal logistic]
  • 129. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Example (Northern Pintail ducks (4)) Posterior distribution I N! λN π(α, N |, n1 , . . . , nI ) ∝ (1 + eαi )−N (N − r)! N ! i=1 I 1 exp αi ni − (αi − µi )2 2σ 2 i=1
  • 130. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Example (Northern Pintail ducks (5)) For the conditional posterior distribution 1 π(αi |N, n1 , . . . , nI ) ∝ exp αi ni − (αi − µi )2 (1+eαi )N , 2σ 2 the ARS algorithm can be implemented since 1 αi ni − (αi − µi )2 − N log(1 + eαi ) 2σ 2 is concave in αi .
  • 131. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities Posterior distributions of capture log-odds ratios for the years 1957–1965. 1957 1958 1959 1.0 1.0 1.0 0.8 0.8 0.8 0.6 0.6 0.6 0.4 0.4 0.4 0.2 0.2 0.2 0.0 0.0 0.0 −10 −9 −8 −7 −6 −5 −4 −3 −10 −9 −8 −7 −6 −5 −4 −3 −10 −9 −8 −7 −6 −5 −4 −3 1960 1961 1962 1.0 1.0 1.0 0.8 0.8 0.8 0.6 0.6 0.6 0.4 0.4 0.4 0.2 0.2 0.2 0.0 0.0 0.0 −10 −9 −8 −7 −6 −5 −4 −3 −10 −9 −8 −7 −6 −5 −4 −3 −10 −9 −8 −7 −6 −5 −4 −3 1963 1964 1965 1.0 1.0 1.0 0.8 0.8 0.8 0.6 0.6 0.6 0.4 0.4 0.4 0.2 0.2 0.2 0.0 0.0 −10 −9 −8 −7 −6 −5 −4 −3 −10 −9 −8 −7 −6 −5 −4 −3 0.0 −10 −9 −8 −7 −6 −5 −4 −3
  • 132. Markov Chain Monte Carlo Methods Random variable generation Log-concave densities True 1960 0.8 0.6 0.4 0.2 0.0 −8 −7 −6 −5 −4 distribution versus histogram of simulated sample
  • 133. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Motivation and leading example Random variable generation Monte Carlo Integration Introduction Monte Carlo integration Importance Sampling Acceleration methods Bayesian importance sampling Notions on Markov Chains The Metropolis-Hastings Algorithm
  • 134. Markov Chain Monte Carlo Methods Monte Carlo Integration Introduction Quick reminder Two major classes of numerical problems that arise in statistical inference ◦ Optimization - generally associated with the likelihood approach
  • 135. Markov Chain Monte Carlo Methods Monte Carlo Integration Introduction Quick reminder Two major classes of numerical problems that arise in statistical inference ◦ Optimization - generally associated with the likelihood approach ◦ Integration- generally associated with the Bayesian approach
  • 136. Markov Chain Monte Carlo Methods Monte Carlo Integration Introduction skip Example! Example (Bayesian decision theory) Bayes estimators are not always posterior expectations, but rather solutions of the minimization problem min L(θ, δ) π(θ) f (x|θ) dθ . δ Θ Proper loss: For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean
  • 137. Markov Chain Monte Carlo Methods Monte Carlo Integration Introduction skip Example! Example (Bayesian decision theory) Bayes estimators are not always posterior expectations, but rather solutions of the minimization problem min L(θ, δ) π(θ) f (x|θ) dθ . δ Θ Proper loss: For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean Absolute error loss: For L(θ, δ) = |θ − δ|, the Bayes estimator is the posterior median
  • 138. Markov Chain Monte Carlo Methods Monte Carlo Integration Introduction skip Example! Example (Bayesian decision theory) Bayes estimators are not always posterior expectations, but rather solutions of the minimization problem min L(θ, δ) π(θ) f (x|θ) dθ . δ Θ Proper loss: For L(θ, δ) = (θ − δ)2 , the Bayes estimator is the posterior mean Absolute error loss: For L(θ, δ) = |θ − δ|, the Bayes estimator is the posterior median With no loss function use the maximum a posteriori (MAP) estimator arg max ℓ(θ|x)π(θ) θ
  • 139. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Monte Carlo integration Theme: Generic problem of evaluating the integral I = Ef [h(X)] = h(x) f (x) dx X where X is uni- or multidimensional, f is a closed form, partly closed form, or implicit density, and h is a function
  • 140. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Monte Carlo integration (2) Monte Carlo solution First use a sample (X1 , . . . , Xm ) from the density f to approximate the integral I by the empirical average m 1 hm = h(xj ) m j=1
  • 141. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Monte Carlo integration (2) Monte Carlo solution First use a sample (X1 , . . . , Xm ) from the density f to approximate the integral I by the empirical average m 1 hm = h(xj ) m j=1 which converges hm −→ Ef [h(X)] by the Strong Law of Large Numbers
  • 142. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Monte Carlo precision Estimate the variance with m 1 1 vm = [h(xj ) − hm ]2 , mm−1 j=1 and for m large, hm − Ef [h(X)] √ ∼ N (0, 1). vm Note: This can lead to the construction of a convergence test and of confidence bounds on the approximation of Ef [h(X)].
  • 143. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Example (Cauchy prior/normal sample) For estimating a normal mean, a robust prior is a Cauchy prior X ∼ N (θ, 1), θ ∼ C(0, 1). Under squared error loss, posterior mean ∞ θ 2 2 e−(x−θ) /2 dθ −∞ 1+θ δ π (x) = ∞ 1 2 e−(x−θ) /2 dθ −∞ 1 + θ2
  • 144. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Example (Cauchy prior/normal sample (2)) Form of δ π suggests simulating iid variables θ1 , · · · , θm ∼ N (x, 1) and calculating m m ˆπ θi 1 δm (x) = 2 2 . i=1 1 + θi i=1 1 + θi The Law of Large Numbers implies ˆπ δm (x) −→ δ π (x) as m −→ ∞.
  • 145. Markov Chain Monte Carlo Methods Monte Carlo Integration Monte Carlo integration Ran 10.6 10.4 10.2 10.0 9.8 9.6 0 200 400 600 800 1000 iterations
  • 146. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Importance sampling Paradox Simulation from f (the true density) is not necessarily optimal
  • 147. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Importance sampling Paradox Simulation from f (the true density) is not necessarily optimal Alternative to direct sampling from f is importance sampling, based on the alternative representation f (x) Ef [h(X)] = h(x) g(x) dx . X g(x) which allows us to use other distributions than f
  • 148. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Importance sampling algorithm Evaluation of Ef [h(X)] = h(x) f (x) dx X by 1. Generate a sample X1 , . . . , Xn from a distribution g 2. Use the approximation m 1 f (Xj ) h(Xj ) m g(Xj ) j=1
  • 149. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Same thing as before!!! Convergence of the estimator m 1 f (Xj ) h(Xj ) −→ h(x) f (x) dx m g(Xj ) X j=1
  • 150. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Same thing as before!!! Convergence of the estimator m 1 f (Xj ) h(Xj ) −→ h(x) f (x) dx m g(Xj ) X j=1 converges for any choice of the distribution g [as long as supp(g) ⊃ supp(f )]
  • 151. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Important details ◦ Instrumental distribution g chosen from distributions easy to simulate ◦ The same sample (generated from g) can be used repeatedly, not only for different functions h, but also for different densities f ◦ Even dependent proposals can be used, as seen later PMC chapter
  • 152. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Although g can be any density, some choices are better than others: ◦ Finite variance only when f (X) f 2 (X) Ef h2 (X) = h2 (x) dx < ∞ . g(X) X g(X)
  • 153. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Although g can be any density, some choices are better than others: ◦ Finite variance only when f (X) f 2 (X) Ef h2 (X) = h2 (x) dx < ∞ . g(X) X g(X) ◦ Instrumental distributions with tails lighter than those of f (that is, with sup f /g = ∞) not appropriate. ◦ If sup f /g = ∞, the weights f (xj )/g(xj ) vary widely, giving too much importance to a few values xj .
  • 154. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Although g can be any density, some choices are better than others: ◦ Finite variance only when f (X) f 2 (X) Ef h2 (X) = h2 (x) dx < ∞ . g(X) X g(X) ◦ Instrumental distributions with tails lighter than those of f (that is, with sup f /g = ∞) not appropriate. ◦ If sup f /g = ∞, the weights f (xj )/g(xj ) vary widely, giving too much importance to a few values xj . ◦ If sup f /g = M < ∞, the accept-reject algorithm can be used as well to simulate f directly.
  • 155. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Cauchy target) Case of Cauchy distribution C(0, 1) when importance function is Gaussian N (0, 1). Ratio of the densities p⋆ (x) √ exp x2 /2 ̺(x) = = 2π p0 (x) π (1 + x2 ) very badly behaved: e.g., ∞ ̺(x)2 p0 (x)dx = ∞ . −∞ Poor performances of the associated importance sampling estimator
  • 156. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling 200 150 100 50 0 0 2000 4000 6000 8000 10000 iterations Range and average of 500 replications of IS estimate of E[exp −X] over 10, 000 iterations.
  • 157. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Optimal importance function The choice of g that minimizes the variance of the importance sampling estimator is |h(x)| f (x) g ∗ (x) = . Z |h(z)| f (z) dz
  • 158. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Optimal importance function The choice of g that minimizes the variance of the importance sampling estimator is |h(x)| f (x) g ∗ (x) = . Z |h(z)| f (z) dz Rather formal optimality result since optimal choice of g ∗ (x) requires the knowledge of I, the integral of interest!
  • 159. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Practical impact m j=1 h(Xj ) f (Xj )/g(Xj ) m , j=1 f (Xj )/g(Xj ) where f and g are known up to constants. ◦ Also converges to I by the Strong Law of Large Numbers. ◦ Biased, but the bias is quite small
  • 160. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Practical impact m j=1 h(Xj ) f (Xj )/g(Xj ) m , j=1 f (Xj )/g(Xj ) where f and g are known up to constants. ◦ Also converges to I by the Strong Law of Large Numbers. ◦ Biased, but the bias is quite small ◦ In some settings beats the unbiased estimator in squared error loss. ◦ Using the ‘optimal’ solution does not always work: m j=1 h(xj ) f (xj )/|h(xj )| f (xj ) #positive h − #negative h m = m j=1 f (xj )/|h(xj )| f (xj ) j=1 1/|h(xj )|
  • 161. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Selfnormalised importance sampling For ratio estimator n n n δh = ωi h(xi ) ωi i=1 i=1 with Xi ∼ g(y) and Wi such that E[Wi |Xi = x] = κf (x)/g(x)
  • 162. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Selfnormalised variance then n 1 var(δh ) ≈ var(Sh ) − 2Eπ [h] cov(Sh , S1 ) + Eπ [h]2 var(S1 ) . n n n n n2 κ2 for n n n n Sh = Wi h(Xi ) , S1 = Wi i=1 i=1 Rough approximation n 1 varδh ≈ varπ (h(X)) {1 + varg (W )} n
  • 163. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Student’s t distribution) X ∼ T (ν, θ, σ 2 ), with density −(ν+1)/2 Γ((ν + 1)/2) (x − θ)2 fν (x) = √ 1+ . σ νπ Γ(ν/2) νσ 2 Without loss of generality, take θ = 0, σ = 1. Problem: Calculate the integral ∞ n sin(x) fν (x)dx. 2.1 x
  • 164. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Student’s t distribution (2)) • Simulation possibilities ◦ Directly from fν , since fν = N (0,1) √ 2 χν
  • 165. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Student’s t distribution (2)) • Simulation possibilities ◦ Directly from fν , since fν = N (0,1) √ 2 χν ◦ Importance sampling using Cauchy C (0, 1)
  • 166. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Student’s t distribution (2)) • Simulation possibilities ◦ Directly from fν , since fν = N (0,1) √ 2 χν ◦ Importance sampling using Cauchy C (0, 1) ◦ Importance sampling using a normal N (0, 1) (expected to be nonoptimal)
  • 167. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Example (Student’s t distribution (2)) • Simulation possibilities ◦ Directly from fν , since fν = N (0,1) √ 2 χν ◦ Importance sampling using Cauchy C (0, 1) ◦ Importance sampling using a normal N (0, 1) (expected to be nonoptimal) ◦ Importance sampling using a U ([0, 1/2.1]) change of variables
  • 168. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling Sampling 7.0 6.5 6.0 5.5 5.0 0 10000 20000 30000 40000 50000 from f (solid lines), importance sampling with Cauchy instrumental (short dashes), U ([0, 1/2.1]) instrumental (long dashes) and normal instrumental (dots).
  • 169. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling IS suffers from curse of dimensionality As dimension increases, discrepancy between importance and target worsens skip explanation
  • 170. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling IS suffers from curse of dimensionality As dimension increases, discrepancy between importance and target worsens skip explanation Explanation: Take target distribution µ and instrumental distribution ν N Simulation of a sample of iid samples of size n x1:n from µn = µ n Importance sampling estimator for µn (fn ) = fn (x1:n )µn (dx1:n ) N i N i=1 fn (ξ1:n ) j=1 Wji µn (fn ) = N N , j=1 j=1 Wj where Wk = dµ (ξk ), and ξj are iid with distribution ν. i dν i i For {Vk }k≥0 , sequence of iid nonnegative random variables and for n ≥ 1, Fn = σ(Vk ; k ≤ n), set n Un = Vk k=1
  • 171. Markov Chain Monte Carlo Methods Monte Carlo Integration Importance Sampling IS suffers (2) Since E[Vn+1 ] = 1 and Vn+1 independent from Fn , E(Un+1 | Fn ) = Un E(Vn+1 | Fn ) = Un , and thus {Un }n≥0 martingale √ Since x → x concave, by Jensen’s inequality, E( Un+1 | Fn ) ≤ E(Un+1 | Fn ) ≤ Un √ and thus { Un }n≥0 supermartingale Assume E( Vn+1 ) < 1. Then n E( Un ) = E( Vk ) → 0, n → ∞. k=1