R programs that have been discussed in class are included here.

- 16 Jan 2018: Using R, using sp, and mapping
- Introduction to R for Stat 406 Updated 11 Jan to include reading excel files and RStudio extensions
- Introduction to the sp package.
- spIntro.r R code for the Introduction to the sp package.
- maps.r Drawing maps

- 18 Jan: spatial sampling
- sample.r How to draw random samples
- simsample.r Illustration of using simulation to evaluate properties of estimators.

- 20 Jan: for HW 1
- Y.r Defines Y() used in HW 1, problem 4

- 25, 31 Jan: areal data
- areal1.r Defining neighbors and estimating spatial correlation.

Updated location of the Auckland shape file. - areal3.r Fitting linear models with spatially correlated observations
- areal2.r Spatial smoothing, emphasizing Gaussian data

- areal1.r Defining neighbors and estimating spatial correlation.
- 13, 15 Feb: geostatistical data
- prediction1.r R code and comments for inv. dist. weighting and trend surfaces.
- prediction2.r R code and comments for ordinary kriging 'by hand'.
- prediction3.r R code and comments for semivariogram estimation.
- R matrix.pdf Notes on read various data formats into R and working with matrices.

- 20, 22 Feb: geostatistical data, part 4
- prediction4.r R code and comments for fitting a variogram model and ordinary (simple, universal) kriging
- prediction5.r R code and comments for other types of kriging
- prediction6.r cokriging - placeholder in case sufficient class interest
- symbols.r Adding points or polygons to a spplot

- 6, 8 Mar: spatial linear models, part 5
- alliance.r Fitting ANOVA with spatial correlations, usign lsmeans library for ANOVA followup
- alliance.sas SAS code to fit ANOVA with spatial correlations

- The R for Ecologists document written by Dave Roberts.
- Introduction to R document (pdf). I find this has more detail than I need when trying to learn R.