首页 > > 详细

代做MAST90125课程作业、代写R编程设计作业、代做Statistical Learning作业、R实验作业代写 代写R语言编程|代做Python程序

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.
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?
1

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!