12 Activity 2

The purpose of this activity is to explore and reinforce concepts in Chapters 1-3 of Bringing Bayesian Models to Life.

You are encouraged to work with others students in the class to complete this activity.

For this activity let \([a]\) be a beta distribution with \(\alpha=2\) and \(\beta=1\) (i.e., \(a\sim\text{beta}(\alpha=2,\beta=1)\)).

  1. Solve the integral \(\int_{0}^1 [a]da\) analytically (i.e., using pencil and paper).

  2. Approximate the integral \(\int_{0}^1 [a]da\) numerically using the quadrature method with \(m=40\) equally spaced support points (see pg. 12 in BBM2L).

  3. Approximate the integral \(\int_{0}^1 [a]da\) using Monte Carlo integration with \(K=100\) draws (see pg. 18 in BBM2L).

  4. Write 3-5 sentences comparing the results you obtained in questions 1-3 and explain why the analytical and numerical results differ.

  5. Solve the integral \(\int_{0}^1 a[a]da\) analytically. Verify that your answer matches that of the expected value of a beta distribution with \(\alpha=2\) and \(\beta=1\).

  6. Approximate the integral \(\int_{0}^1 a[a]da\) numerically using the quadrature method with \(m=40\) equally spaced support points.

  7. Approximate the integral \(\int_{0}^1 a[a]da\) using Monte Carlo integration with \(K=100\) draws.

  8. This is probably a trick question. Solve the integral \(\int_{0}^1 \text{log}\left(\frac{1}{\mathrm{sin}(a)}\right)[a]da\) analytically.

  9. This is not a trick question. Approximate the integral \(\int_{0}^1 \text{log}\left(\frac{1}{\mathrm{sin}(a)}\right)[a]da\) using Monte Carlo integration with \(K=100\) draws.