### No Office Hours this Week

I will not be holding office hours during finals week (April 10 and April 12).

Best of luck with all your end-of-semester activities!

I will not be holding office hours during finals week (April 10 and April 12).

Best of luck with all your end-of-semester activities!

I love reading Andrew Gelman's blog; it's a great mixture of serious statistical thought, practical data analysis questions, random personal musings, and links to the rest of the stats blogosphere. Gelman is a very smart, famous Bayesian and advisor to our own Cavan Reilly.

He recently wrote two posts about MCMC sampling that you might find interesting/useful.

One is some second-hand skepticism about a recent paper (published in the first post-Brad issue of Bayesian Analysis) on a new Metropolis sampler that doesn't require tuning.

The other is an extended reaction to a talk by Charlie Geyer (from the UofM Stats Department) about convergence issues.

Hey guys: a couple of bug fixes. First of all, there was a mistake in my "outline" of the metropolis code. I had the inequality for the acceptance ratio logic going the wrong direction. The corrected code follows:

## Sample Metropolis-Hastings algorithm # function to compute log(h(theta)) log.h <- function(theta,data){} met <- function(data,initials,NREP){ # Constants n <- dim(data)[1] p <- length(initials) # Empty matrix to hold samples chain <- matrix(NA,NREP+1,p) # Initialize the chain chain[1,] <- initials for (i in 2:(NREP+1)){ # Parameters of the proposal meen <- var <- # Draw a proposal value thetastar <- rnorm(1,meen, var) # Compute the rejection ratio logr <- log.h(thetastar) + dnorm(chain[i-1,],meen,sqrt(var),log=T) - log.h(chain[i-1,]) - dnorm(thetastar,meen,sqrt(var),log=T) # Decide whether to accept or reject if (logr > 0){ chain[i,] <- thetastar } elseif (logr > log(runif(1))) { chain[i,] <- thetastar } else { chain[i,] <- chain[i-1,] } } return(chain[-1,]) }

Second, it appears that in the GeoBugs extra credit opportunity, the maps aren't going to load in because it doesn't like negative x values. One solution is to simply add a large constant to all of the longitude values in the polygon file produced by R so that they are positive.

Hey guys, thought you might want to mark your calendars for **Friday, April 30, 2010** at **10:00 am**, Moos 2-530. That's when my academic grandfather (i.e., Brad's advisor) Alan Gelfand will be speaking on Process Modeling for Space-time Extremes. You guys haven't done much spatial yet, but you may appreciate that he helped popularize the Gibbs sampler for Bayesian analysis in a 1990 JASA article with Smith.

Here are the materials I will be using in class Thursday, January 28, 2010 for the R tutorial:

Online Presentation

Demo R Code File (and test.R)

And here are the materials/websites that I reference:

CRAN (download R and packages)

R Seek (custom search engine for R materials)

R Reference Card (PDF quick reference-- super awesome)

Graph Gallery

Extra stuff:

JAGS (run BUGS models via R independently of WinBUGS/OpenBUGS)

R2WinBUGS (run WinBUGS from R)

BRugs (run OpenBUGS from R)

Instructions for WinBUGS and OpenBUGS on Mac OS X using WINE

I plan to hold office hours every Monday and Wednesday from 9:30-11:00 am in the Biostats TA room (Mayo A446). If you have a class conflict with these, please let me know and we will set something up.

Hello and welcome to the class blog for Spring 2010 Intro to Bayesian Analysis with Dr. Brad Carlin.

I'm Laura Hatfield and I'll be your TA. This blog is where I will post hints about homework, announcements about my office hours, useful links, and solutions to the homework assignments. See you in a couple weeks-- enjoy the rest of break!