Homework 3
due in class, Friday May 4
- Using the temperature data,
read in the file (it is tab-delimited, so you can use sep="\t" in
read.table) and first transform Longitude by multiplying by -1 so
that when you plot by Long and Lat you get a plot that looks like the
geographical layout of the cities in the U.S. (try plot(Long,Lat) to
see).
- Fit a surface to the data using MCMC which you code yourself.
Feel free to keep the model simple by fitting a linear trend with
unknown coefficients (with independent priors), an unknown overall
variance (or precision), and a just a few parameters in the
correlation, e.g., a power correlation with fixed power but unknown
range (isotropic or separable) and with or without a nugget.
- Fit a surface using bgp from the tgp package, and compare your
results. Note that to get a good plot of the results from bgp, you
will want to predict on a grid, for example, by including the
argument
XX=expand.grid(Long=seq(from=-123,to=-70,length=15),Lat=seq(from=25,to=48,length=15)),
and your plot will be even better if you leave out the corners of the
grid where no data has been collected (over the oceans).
- Using the scallop data,
first rotate the data 45 degrees so that a separable correlation
structure is reasonable. Using the rotated data, fit a surface using
bgp, and a surface using btgp. Use image plots to compare the fits to
each other and to a basic interpolation of the data. Comment on your
findings.