1 Linear Regression 2
2 Generating random walk data 3
3 Time series analysis of meteo data 4
3.1 Exploratory data analysis . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Fitting a periodic component . . . . . . . . . . . . . . . . . . . . 5
3.3 Fitting AR model to the residuals . . . . . . . . . . . . . . . . . 5
3.4 Model selection with AIC . . . . . . . . . . . . . . . . . . . . . . 6
3.5 Prediction with an AR model . . . . . . . . . . . . . . . . . . . . 7
4 One-dimensional search with golden section 8
5 Linear and non-linear least squares 9
5.1 By hand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.2 Linear: by lm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.3 Non-linear: using nls . . . . . . . . . . . . . . . . . . . . . . . . 9
5.4 Initial conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.5 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.6 Condence intervals . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.7 Prediction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 Metropolis and Simulated Annealing 12
6.1 Fun with Metropolis . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2 An R function for MCMC . . . . . . . . . . . . . . . . . . . . . 12
6.3 The eect of sigma . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.4 Computing summary statistics . . . . . . . . . . . . . . . . . . . 14
6.5 Initial values and Burn-in . . . . . . . . . . . . . . . . . . . . . . 15
6.6 Simulated Annealing . . . . . . . . . . . . . . . . . . . . . . . . . 15
7 Spatial modelling: introductory matter 16
7.1 Data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1.1 meuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.2 Models: the formula interface; linear regression . . . . . . . . . . 16
7.3 Spatial data in R: the sp package . . . . . . . . . . . . . . . . . . 18
7.3.1 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.3.2 Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.4 Import/export: rgdal . . . . . . . . . . . . . . . . . . . . . . . . 19
8 Geostatistics 20
8.1 Exploratory data analysis . . . . . . . . . . . . . . . . . . . . . . 20
8.2 Simple interpolation algorithms . . . . . . . . . . . . . . . . . . . 20
8.2.1 Trend surface analysis . . . . . . . . . . . . . . . . . . . . 20
8.2.2 Inverse distance interpolation . . . . . . . . . . . . . . . . 21
8.2.3 Thiessen polygons . . . . . . . . . . . . . . . . . . . . . . 22
8.3 Spatial prediction with multiple linear regression . . . . . . . . . 22
8.4 Spatial correlation: the h-scatterplot . . . . . . . . . . . . . . . 25
8.5 Spatial correlation: the variogram cloud . . . . . . . . . . . . . 26
8.6 Spatial correlation: the variogram . . . . . . . . . . . . . . . . . 26
8.7 Sample variogram and variogram model . . . . . . . . . . . . . . 27
8.8 Simple and ordinary kriging . . . . . . . . . . . . . . . . . . . . . 29
8.8.1 Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.8.2 In
uence of Variogram on Prediction . . . . . . . . . . . . 30
8.9 Universal kriging . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
8.10 Regression coecients . . . . . . . . . . . . . . . . . . . . . . . . 36
8.11 Block kriging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8.12 Cokriging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
8.13 Cokriging: the undersampled case . . . . . . . . . . . . . . . . . 39
8.14 Kriging errors and condence intervals . . . . . . . . . . . . . . . 40
8.15 Conditional simulation . . . . . . . . . . . . . . . . . . . . . . . . 41
8.16 Cross validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9 Diusion and partial dierential equations 41