Assignment 12 - Bayesian analyses - 2019

Your goal in this assignment is to conduct a simple linear regression of the two provided data-sets using both Frequentist methods and Bayesian methods (with both non-informative and informative priors; so six analyses total). The two data sets are both contained in the same data.frame: GoodX versus GoodY is pretty high quality data (as evidenced by the small p-value for the slope); the true intercept in this data is 5 and the true slope is 1. BadX versus BadY is the exact same relationship, but the data contains a lot of the noise and the frequentist analysis will return a barely significant p-value for the slope.

Compare the estimates of the slope provided by the frequentist analysis as well as the Bayesian analysis with both kinds of priors. For Bayesian analyses, use the 'MCMCregress' function. In particular, pay attention to how the various methods and various priors can influence your ability to attain an estimate close to truth (does the confidence interval contain truth - for the Bayesian analyses, use the percentiles at the bottom of the summary).

For the Bayesian analyses, use a burn-in of 25000, and mcmc iterations of 25000. For the non-informative prior, use a mean of 0 and a standard deviation of 1000. For the informative prior, use a mean of 0 and standard deviation of 1000 for the intercept, and a mean of 10 and standard deviation of 1 for the slope. Notice that the prior in this case is actually pretty far from truth.

In a word file, using the standard sentences structure, describe the estimated slope (as well as C.I./C.L., p-value (for lm only), and r^2 (for lm only) from each of your 6 analyses. For the Bayesian analyses, provide a plot of the posterior distributions

Data

Excel file used to make data (for purposes of examining truth)