Assignment 2, Question 1 MAST90125: Bayesian


Assignment 2, Question 1 MAST90125: Bayesian
Statistical Learning
Due: Friday 20 September 2019
There are places in this assignment where R code will be required. Therefore set the random
seed so assignment is reproducible.
set.seed(123456) #Please change random seed to your student id number.
Question One (12 marks)
In generalised linear models, rather than estimating effects from the response data directly, we model through
a link function, η(θ), and assume η(θ)i = x0
iβ. The link function can be determined by re-arranging the
likelihood of interest into the exponential family format,
p(y|θ) = f(y)g(θ)e
a) Re-arrange the Poisson probability mass function into the exponential family format to determine the
canonical link function. The Poisson pmf is
P r(y|λ) = λ
To explore some properties of Metropolis sampling, consider the dataset Warpbreaks.csv, which is on LMS.

代做MAST90125课程作业、代写R编程设计作业、代做Statistical Learning作业
This dataset contains information of the number of breaks in a consignment of wool. In addition, Wool type
(A or B) and tension level (L, M or H) was recorded.
b) Fit a Poisson regression to the warpbreak data, with Wool type and tension treated as factors using the
function glm in R. Report co-efficient estimates and the variance-covariance matrix.
c) Fit a Bayesian Poisson regression using Metropolis sampling. Assume flat priors for all coefficients.
Extract the design matrix X from the glm fitted in a). For the proposal distribution, use a Normal
distribution with mean θ
(t−1) and variance-covariance matrix c
2Σˆ where Σ is the variance-covariance
matrix from the glm fit. Consider three candidates for c, 1.6/
of parameters estimated. Run the Metropolis algorithm for 10,000 iterations, and discard the first 5,000.
Report the following:
• Check, using graphs and appropriate statistics, that each chain converges to the same distribution. To
do this, you may find installing the R package coda helpful.
• The proportion of candidate draws that were accepted.
• The effective sample size for each chain.
• What do you think is the best choice for c. Does this match the results stated in class on efficiency and
optimal acceptance rate?

Because professional, so trustworthy. If necessary, please add QQ: 99515681 or email: [email protected]

Micro letter: codehelp

Guess you like

Origin www.cnblogs.com/lpka/p/11519845.html