MATH3871/MATH5960 Bayesian Inference and Computation Term 3, 2025 Assignment General instructions: • This assignment is due Friday 14th November (Week 9), 5pm Sydney time, and must be uploaded to Moodle. • This assignment counts for 20% of the final course mark. • There are a total of 2 exercises and 28 marks. • The usual UNSW late submission penalties apply: For each day the assignment is late (rounded up, so that 1 second late = 1 day late) there is a 5% penalty, to a maximum of 5 days late (25% penalty), after which the submission will not be accepted and it will be scored as zero. • Make sure you submit your work as a single PDF document of not more than 8 pages, including the plagiarism declaration (pages in excess of this will not be graded) using the name: z1234567-FirstName-Surname.pdf. • Prepare your submission using LaTeX, and include R-code in the pdf. • Clear worked solutions are required for full marks. • Assignments without a signed plagiarism declaration (below) will not be accepted. Group work instructions (optional): 1. You can work in groups of 1–3 people. Each member of a group has to submit the same assignment on Moodle (with the names and zIDs of all members of the group on the front page). All members of the group will get the same marks. 2. You can split the work amongst the members of the group in any way you like, but free-riders should note that all of the assignment questions are examinable and are potentially on the final exam. Thus, it is in everybody’s interest to understand the assignment questions and be able to solve them. 3. You can form groups with members from a mix of MATH3871 and MATH5960 students. 4. Assignment group work is optional. Individuals who do not wish to work in a group are free to submit an individual assignment. 1 MATH3871/MATH5960 Bayesian Inference and Computation Term 3, 2025 ASSIGNMENT FRONT PAGE Use this as the first page of your assignment (counts as one of the maximum of 8 pages). I declare that this assessment item is my own work, except where acknowledged, and has not been submitted for academic credit elsewhere. I acknowledge that the assessor of this item may, for the purpose of assessing this item reproduce this assessment item and provide a copy to another member of the University; and/or communicate a copy of this assessment item to a plagiarism checking service (which may then retain a copy of the assessment item on its database for the purpose of future plagiarism checking). I certify that I have read and understood the University Rules in respect of Student Academic Misconduct. Complete the below for each member of your group (1–3 people): Name #1: zID #1: Signature #1: Name #2: zID #2: Signature #2: Name #3: zID #3: Signature #3: 2 Exercise 1 [10 marks] Let x1, . . . , xn ∈ Rd be n iid d-dimensional vectors. Suppose that we wish to model xi ∼ Nd(µ,Σ) for i = 1, . . . , n where µ ∈ R is an unknown mean vector, and Σ is a known positive semi-definite covariance matrix. (a) [3 marks] Adopting the conjugate prior µ ∼ Nd(µ0,Σ0) and by completing the square, from the Week 4 tutorial we know that the resulting posterior distribution for µ|x1, . . . , xn is Nd(µˆ, Σˆ) where µˆ = (Σ−10 + nΣ −1)−1(Σ−10 µ0 + nΣ −1x¯) where x¯ = 1 n ∑ i xi is the sample mean vector, and Σˆ = (Σ−10 + nΣ −1)−1. A friend uses this model to analyse their data, and gives you their µˆ and Σˆ. What values of µ0 and Σ0 did they choose? (b) [3 marks] Under what circumstances can the prior and posterior means be equal? Under what circumstances can the prior and posterior variances be equal? (c) [4 marks] Derive Jeffreys’ prior piJ(µ) for µ. Hint: If you need help with vector differentiation, you can find out about this on various places on the internet. One such place is https://en.wikipedia.org/wiki/Matrix calculus. Exercise 2 [18 marks] Archaeology provides a rich source of complex, non-standard problems, where if the prior is avail- able, it needs careful elicitation. Here we look at a data study of the technique of corbelling, a method of roofing spaces with blocks of stone, widely used in prehistory. For many decades, archaeologists and historians have been fascinated by the ability of prehistoric communities to develop sufficient skills to allow them to construct these domes, some of which have survived for over 4,000 years. These speculations have led to applied mathematical models being developed as an aid to understanding why the domes stand up and how they were constructed. Consider the simplest of these models yi = αx β i where y denotes the radius of the dome at which measurements were taken, and x is the depth from the apex of the dome to the point at which measurements were taken. It is easier to work with the log linear model ln yi = lnα + β lnxi + i where i ∼ N(0, σ2) are iid error terms. Below are 24 measurements from the late Minoan tholos dome at Stylos, of Crete in Greece. You can find these in the file stylos.csv For each of the following, provide your code (R or Python or . . . ), relevant output, and discussion. 3 x (depth) 0.04 0.24 0.44 0.64 0.84 1.04 1.24 1.44 1.64 1.84 2.04 2.24 y (radius) 0.40 0.53 0.70 0.90 1.06 1.16 1.26 1.36 1.47 1.62 1.67 1.68 x (depth) 2.44 2.64 2.84 3.04 3.24 3.44 3.64 3.84 4.04 4.24 4.44 4.64 y (radius) 1.77 1.82 1.89 1.96 2.00 2.05 2.10 2.10 2.14 2.13 2.15 2.14 Table 1: Measurements for the late Minoan tholos at Stylos. (a) [3 marks] Specify and justify a suitable joint prior distribution, pi(θ), for θ = (α˜, β, σ2), where α˜ = lnα. Hence write down the functional form of the posterior distribution. (b) [4 marks] Using either rejection sampling, importance sampling, or Markov chain Monte Carlo, draw samples from the posterior distribution pi(θ|x). (You may wish to write a function that inputs an observed data matrix, and returns posterior samples, which may help with later questions.) Depending on your choice of algorithm, demonstrate how you achieved good algorithm efficiency/performance via thoughtful choice of: • Rejection sampling: sampling distribution g(θ), and constant K such that pi(θ|x) ≤ Kg(θ),∀θ, • Importance sampling: sampling distribution g(θ), • Markov chain Monte Carlo: Metropolis-Hastings proposal distribution q(θt, θ′). (c) [2 marks] Produce a plot of each estimated univariate and bivariate posterior marginal distribution (6 plots). Comment on the dependence structure. (d) [3 marks] Estimate and plot the predictive distribution of a future radius measurement (y∗1) for the first (observed) depth measurement of x1 = 0.04, based on a posterior distribution that does not include this datapoint. I.e. for i = 1 estimate pi(y∗i |x−i, y−i) ∝ ∫ pi(y∗i |θ)pi(θ|x−i, y−i)dθ where x = (x1, . . . , xn), and x−i is the vector x but excluding the i-th element. Plot the observed y1 = 0.4 on this predictive distribution. Construct a central 95% credible interval for y∗1 and add this to the plot. Is the observed datapoint y1 in this interval? (e) [3 marks] Using the same process as for part (d), produce a plot with xi on the x-axis, and a line denoting the central 95% credible interval for y∗i |x−i, y−i for each i = 1, . . . , 24 on the y-axis. Draw the observed data (xi, yi) in each case. Comment on the ability of this model to describe the observed data. (f) [3 marks] Repeat (e) but for the simplified model yi = αxi ln yi = lnα + lnxi + i obtained by fixing β = 1. Based solely on these goodness-of-fit plots and the posterior marginal for β in part (c), discuss whether β = 1 is supported by the data. 4
学霸联盟