Stats 102C - Monte Carlo Integration Lecture Notes PDF

Summary

These lecture notes cover Monte Carlo integration, a statistical method for estimating integrals. They explain the concept, provide examples, and discuss the application of Monte Carlo methods in different contexts, such as approximating probabilities in various distributions.

Full Transcript

Stats 102C - Lecture 2-1: Monte Carlo Integration Miles Chen, PhD Week 2 Monday Copyright Miles Chen. For personal use only. Do not distribute. 1...

Stats 102C - Lecture 2-1: Monte Carlo Integration Miles Chen, PhD Week 2 Monday Copyright Miles Chen. For personal use only. Do not distribute. 1 Section 1 Lecture 2-1: Monte Carlo Integration Copyright Miles Chen. For personal use only. Do not distribute. 2 Review: Making predictions with the posterior distribution On Friday, we ended lecture with the baseball example. Our prior distribution for θ is a beta distribution with α = 81 and β = 219. We observed a new player with 10 at bats and 5 hits. Our posterior distribution for θ is now a beta distribution with α = 86 and β = 224. “If this player has three at bats in the next game, what is the probability he gets exactly two hits?” 3  The answer depends on the value of θ: 2 θ2 (1 − θ)1 θ is a random variable. We can estimate the expected value of the probability via Monte Carlo. Copyright Miles Chen. For personal use only. Do not distribute. 3 Estimate the expected value of the probability via Monte Carlo We use Monte Carlo methods to estimate the expected value of g(x) Z n 1X Ef [g(X)] = g(x)f (x)dx ≈ g(xj ) X n j=1 Where xj are values randomly drawn from a distribution with PDF = f (x). f (x) is the PDF of a beta distribution with α = 86 and β = 224. We use R’s rbeta() function to draw random values from this distribution. 3  The function g(x) is the probability of getting 2 hits in 3 at bats: 2 θ2 (1 − θ)1 set.seed(1) samp

Use Quizgecko on...
Browser
Browser