5 Day 5 (February 4)
5.1 Announcements
Please read (and re-read) Ch. 3 and 4 in BBM2L book.
Selected questions/clarifications from journals
- How to choose/select a distribution
- Definition of a model
- Combining data and models/assumptions gives use prediction/forecasts/inference.
- Sample size questions
- n = Inf
- n = 0
- Power analysis
- Anxiety/statistical therapy
- Adaptive designs
- How to choose/select a distribution
Good reading from The American Statistician link
5.2 Building our first statistical model
- The backstory
- Building a statistical model using a likelihood-based (classical) approach
- Specify (write out) the likelihood
- Select an approach to estimate unknown parameters (e.g., maximum likelihood)
- Quantify uncertainty in unknown parameters (e.g., using normal approximation, see here)
- Building a statistical model using a Bayesian approach
- Specify (write out) the likelihood/data model
- Specify the parameter model (or prior) including hyper-parameters
- Select an approach to obtain the posterior distribution
- Analytically (i.e., pencil and paper)
- Simulation-based (e.g., Metropolis-Hastings, MCMC, importance sampling, ABC, etc)
5.3 Numerical Integration
Why do we need integrals to do Bayesian statistics?
- Example using Bayes theorem to estimate prevalence rate of rabies
- Why it is important to keep track of what we are calculating (i.e., clarity in what is being estimated)
Numerical approximation vs. analytical solutions
Definition of a definite integral ∫baf(z)dz=limQ→∞Q∑q=1Δqf(zq) where Δq=b−aQ and zq=a+q2Δq.
Riemann approximation (midpoint rule)∫baf(z)dz≈Q∑q=1Δqf(zq) where Δq=b−aQ and zq=a+2q−12Δq.
Using similar approach in R (Adaptive quadrature)
## 0.9999367 with absolute error < 4.8e-12
5.4 Monte Carlo Integration
Deterministic vs stochastic methods to approximate integrals
- Work well for high-dimensional multiple integrals
- Easy to program
Monte Carlo integration
- E(g(y))=∫g(y)[y|θ]dy≈1QQ∑q=1g(yq)
- Examples:
- E(y)=∫∞−∞y1√2πσ2e−12σ2(y−μ)2dy
## [1] 1.99951
- E((y−μ)2)=∫∞−∞(y−μ)21√2πσ2e−12σ2(y−μ)2dy
## [1] 8.99337
- E(1y)=∫∞−∞1y1√2πσ2e−12σ2(y−μ)2dy
## [1] 0.7251141
Questions about activity 2?
Live example using bat and coin data/model