* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Assignment
Survey
Document related concepts
Transcript
Poisson regression Haberman (1978) considers an experiment involving subjects reporting one stressful event. The collected data are y1, y2 ,..., y18 , where yi interview. Suppose yi is the number of events recalled i months before the is Poisson distributed with mean i , where the i satisfy the regression model log i 0 1i . The data file stress.csv contains the observed values. a. (2 points) If 0 , 1 is assigned a joint uniform prior 0,1 , show that the logarithm of the posterior density is given up to an additive constant, by log f 0 , 1 | data i1 yi 0 1i exp 0 1i . 18 b. (1 point) Write an R function to compute the logarithm of the posterior density of 0 , 1 . c. (1 point) Suppose we are interested in estimating the posterior mean and standard deviation for the intercept and the slope. Through using optim() (method = "BFGS") with the data, find the maximum likelihood estimate for 0 , 1 and the corresponding estimated matrix of variance covariance, using the starting value for 0 1 and 1 1 . d. (3 points) Using the output of optim(), and the multivariate t distribution as the proposal distribution, set the seed to be 1234, and using the data, construct a Metropolis-Hastings random walk Algorithm for simulating from the posterior density. Compute the posterior mean, median, mode, and standard deviation for 0 and 1 , using 10000 iterations. The multivariate t distribution can be compute in R using the following function rmvt(n, sigma=cov*(df-2)/df, df=df) in package rmvt, where df = 16, cov is the covariance matrix estimated from part c). e. (1 point) Compare the result in part d) with what we get in part c) using optim(). f. (1 point) Estimate the highest density interval (HDI). g. (1 point) Construct the histogram of 0 and 1 with the density overlay on the top, with Mean, Mode, Median and standard deviation display on the graph.