STAT 638 (Fall 2026), Lecture 7
Overview
Samiran Sinha moves from a binomial survey example to Monte Carlo integration, showing how posterior calculations can be approximated with random draws when analytic integration is inconvenient. With 57 successes in 100 trials and a Beta(2,2) prior, he demonstrates estimating posterior means, variances, and probabilities, then applies the same approach to the mean lifetime of a phone battery.
Key takeaways
- For 100 Bernoulli observations with 57 successes, inference about θ can use either the full Bernoulli likelihood or the binomial likelihood for the total; the binomial coefficient is constant in θ.
- A uniform Beta(1,1) prior with 57 successes and 43 failures yields a Beta(58,44) posterior, while a Beta(2,2) prior yields Beta(59,45).
- A Monte Carlo estimate of a posterior expectation is the average of g(θ) over posterior draws; increasing the number of draws generally reduces simulation variability.
- For the Beta(59,45) posterior, the mean is about 0.5673 and the variance about 0.00233; 10,000 simulated draws closely approximate both quantities.
- Posterior probabilities such as P(θ≤0.5) can be estimated by counting qualifying posterior draws; the example’s probability is about 0.083.
- When θ is a gamma-distributed exponential rate, reciprocal draws 1/θ provide Monte Carlo samples of the corresponding battery mean lifetime without deriving its inverse-gamma summaries analytically.
Chapters
- Samiran Sinha asks students to begin their projects early and verify that datasets are accessible and research questions are reasonable.
- The survey example samples 100 people from a much larger county population and records support for a policy as binary outcomes.
- Each response Yᵢ is conditionally Bernoulli with success probability θ; the 100 observations are conditionally IID.
- For a particular sequence with y successes, the likelihood is θʸ(1−θ)^(100−y); for the total Y=y, the binomial probability includes the coefficient choose(100,y).
- The binomial coefficient does not depend on θ, so the individual-observation and success-count likelihoods give the same inference about θ.
- With y=57 and n=100, Sinha evaluates the binomial probability across θ values from 0 to 1 in increments of 0.1.
- The R demonstration uses the binomial probability mass function, dbinom, to calculate the probability of 57 successes for each candidate θ.
- The plotted likelihood is largest near the observed success proportion, 57/100 = 0.57.
- For a discrete uniform prior over 11 grid values, each θ value has prior probability 1/11; posterior probabilities are normalized likelihood values.
- The discrete posterior plot contrasts the likelihood across θ with the updated posterior probabilities after observing 57 successes.
- With a continuous uniform prior density on [0,1], the posterior is Beta(58,44), from adding 57 successes and 43 failures to the Beta(1,1) prior.
- Sinha asks students to compare the discrete posterior, the continuous beta posterior density, and the uniform prior.
- Students may use Python, but Sinha asks them to convert their code to R with tools such as ChatGPT or Claude so he can review it.
- He recommends checking converted code by running it and verifying that it reproduces the original results.
- Exercise 3.2 and related problems provide practice for numerical questions that may appear on quizzes and exams.
- Monte Carlo methods approximate difficult integrals by averaging a large number of random samples.
- The law of large numbers says the sample average of g(X) converges to its expectation when the expectation exists.
- In Bayesian inference, draws θ₁,…,θₙ from the posterior let the average of g(θ) approximate its posterior expectation.
- Posterior predictive distributions are one setting where integrating over the posterior parameter can be difficult.
- For 57 successes and a Beta(2,2) prior, the posterior is Beta(59,45); 10,000 simulated draws produce a mean near 0.5672.
- The analytical posterior mean is 59/(59+45), about 0.5673, illustrating the small sampling error in the Monte Carlo estimate.
- The analytical posterior variance is about 0.00233, compared with a simulated estimate near 0.00236 from 10,000 draws.
- Smaller draw counts, such as 100, produce more variable estimates because each result depends on random sampling.
- The posterior probability P(θ≤0.5) can be estimated by the fraction of posterior draws at or below 0.5.
- For the Beta(59,45) posterior, the theoretical probability is approximately 0.083; Monte Carlo estimates vary slightly around that value.
- A histogram of 10,000 posterior draws approximates the beta density, so the empirical distribution also visualizes the posterior.
- In the exponential battery-lifetime example, the posterior for the rate θ is Gamma with shape 10 and rate 355940.
- The mean battery lifetime is ψ=1/θ; because θ has a gamma distribution, ψ has an inverse-gamma distribution.
- Sinha generates 10,000 gamma draws in R, takes their reciprocals, and averages them to estimate the posterior mean lifetime.
- Repeated simulations give slightly different estimates, roughly 395 to 397 in the demonstration, while larger samples reduce Monte Carlo variability.
Transcript excerpt
0:00 Sinha, Samiran: Good morning. So, today, we'll talk about Example 3.1. Sinha, Samiran: From your book, from the reporting's book. Sinha, Samiran: and Monte Carlo Method of Integration of Chapter 4. Sinha, Samiran: Now, the book is already given on Canvas. Sinha, Samiran: If you go to modules, And… Sinha, Samiran: Scroll down to Assignments with Solution with the tentative Schedule to keep up with the course. Sinha, Samiran: This is, exercise problems from the book. Sinha, Samiran: And we'll talk about example 3.1, the problem 3.1. Sinha, Samiran: Now, before I start, I request everyone that if you have not started your project.
1:00 Sinha, Samiran: Please look into the project problems. Sinha, Samiran: Because there are so many problems I have written. Sinha, Samiran: Maybe there could be some mistakes from my end, so please check them. Sinha, Samiran: Whether the data sets are really available, I mean, accessible to you, some of the data to access, you need to register, that is fine, but after registration, you should be able to access it. Sinha, Samiran: And, the scientific questions for every problem, make sure they are reasonable… Sinha, Samiran: If any mistakes happen, if I have done any… anything wrong, please let me know as soon as possible. Sinha, Samiran: Towards the end of the semester, do not do it, okay? And it has a significant weight for your grade, so please start working on it as soon as possible. Sinha, Samiran: Alright, so Chapter 3.
2:00 Sinha, Samiran: Here, suppose we are going to sample 100 individuals. Sinha, Samiran: Promi? Sinha, Samiran: county, Of size, size much larger than 100, and ask each sample person whether they support policy. Sinha, Samiran: Z or not? Sinha, Samiran: Let Yi equal to 1 if person i in the sample supports the policy, Y equal to 0, otherwise.
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Samiran Sinha.