Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/AstroStat/astro193/HW6-03-02-2015.pdf
Дата изменения: Mon Mar 2 22:12:05 2015
Дата индексирования: Sun Apr 10 11:26:34 2016
Кодировка:
Homework 6
March 2, 2015 Due on March 13, 2015 This is a simple fit of a straight line to noisy data as in the HW 4 y a + bx = , i i where a and b are the unknown parameters. The data set has very regular statistical properties. The noise has Gaussian statistics with an rms . (1) Write your own Markov Chain Monte Carlo (MCMC) program to estimate the parameters and their errors. Submit your code. Use the Metropolis sampler. Try to write your program in a flexible way so you can expand it for more complex problems later. (1a) For extra challenge, also implement a Gibbs sampler version. (2) Plot the data and do an "eyeball" estimate (i.e., no fancy mathematical calculations, but explain how you arrived at your answers) of the parameters a, b, nd and . a a b , (3) Use the answers in part (1) to set the initial values of the input parameters. Run your MCMC code. Plot the traces of the parameters. (4) Repeat [3] for different values of the step size. In each case, identify the burnin period and calculate the acceptance rate and the effective sample size, excluding the burnin period. Do this a sufficient number of times to ensure the peak has been bracketed. Make plots of acceptance rate and effective sample size as a function of step size. Choose the optimal step size and use it in for (5)(8). (5) Run your MCMC code using the optimal step size and starting from the initial values from (3) (it's more interesting if you don't start too close to the "right" answers). Plot the parameters vs. iteration number. Verify that the acceptance rate is as expected. Plot the tracks on the (a,b) plane for both Metropolis (and Gibbs if you have done it) as demonstrated in the class. (6) Calculate the parameter estimates and their errors and plot their probability density functions (PDFs). (7) Calculate the acceptance ratio and effective sample size in Metropolis (and Gibbs if you have done it) cases (two runs will suffice). (8) Change the starting parameter values to explore how the parameter estimates are affected run 10 simulations and calculate Rhat.