# Tutorials¶ Here are the many tutorials I’ve written 1 dealing with various aspects of spatial statistics. Please note the dates of each one, the older ones may be partly obsolete or require some adjustment to new versions of the computer programs.

Many of the documents are provided as R Markdown sources. These are most easily processed in the R Studio environment.

## Geostatistics¶

Spatial analysis in R is transitioning to the “Simple Features” representation of spatial objects, as implemented in the sf package. Many of the tutorials listed here were developed with the earlier “Spatial Objects in R” representation, as implemented in the `sp` package. Be alert also to changes in the GDAL and PROJ packages when specifying or transforming coördinate reference systems.

• An introduction to (geo)statistics with R

A brief introduction to exploratory and inferential geo- statistical analysis. At the same time, it introduces the R environment for statistical computing and visualisation] and several R packages, notably `sp` for spatial data structures and `gstat` for conventional geostatistics. The exercise assumes no prior knowledge of either geostatistics nor the R environment.

• `R code`

• Introduction to Rikken, M. G. J., & Van Rijn, R. P. G. (1993) : Soil pollution with heavy metals—An inquiry into spatial variation, cost of mapping and the risk evaluation of copper, cadmium, lead and zinc in the floodplains of the Meuse west of Stein, the Netherlands. Dept. of Physical Geography, Utrecht University. This is the orignal report from which the “Meuse dataset” was created.

• Spatial simulated annealing

Step-by-step explanation of a method to optimally place sample points in order to minimize the maximum or average kriging variance. This is especially useful in irregularly-shaped areas or areas with existing samples.

• Distance education course Geostatistics & Open-source statistical computing

• Supplementary exercises

• Exercise: Change of support

All geographical measurements are made on some support, that is, an interval (1-D), area (2-D) or volume (3-D) of some finite size. As long as the measurements, interpretations, and predictions all refer to the same support, techniques that treat the support as a 0-D point are satisfactory. But if measurements and predictions are made on different supports, the relation between them must be determined and used to adjust the geostatistical analysis.

• Exercise: Compositional variables

Certain (geo)statistical variables, when considered as a group, are not independent in feature space, because they are constrained to sum to some constant; the set of these is called a composition. They should not be modelled separately, rather, as a group.

• Exercise: Spatio-temporal Geostatistics

Spatio-temporal observations are those for which both a spatial location (georeference) and a time of observation are recorded, as well as attributes measured at the specified location and time. This exercise introduces space-time geostatistics to analyze attributes in space and time, separately and simultaneously.

• Written by prof.dr.ir. Alfred Stein (University of Twente), formatted and with some more explanation by me. (1) Simulation of spatial correlation in one dimension, (2) Ordinary Kriging, (3) Universal Kriging, (4) Cokriging, (5) Selecting a grid spacing for kriging. Distributed by permission.

### R Markdown tutorials¶

These illustrate some details of geostatistics. Load into R Studio and compile (“knit”) to HTML, or execute chunk-by-chunk

## Spatial analysis¶

Spatial analysis in R is transitioning to the “Simple Features” representation of spatial objects, as implemented in the sf package. Many of the tutorials listed here were developed with the earlier “Spatial Objects in R” representation, as implemented in the `sp` package. Be alert also to changes in the GDAL and PROJ packages when specifying or transforming coördinate reference systems.

• Trend surfaces in R by Ordinary and Generalized Least Squares

A trend surface is a map of some continuous variable, computed as a function of the coördinates. In many cases the assumption that the OLS residuals are spatially-independent is not true, so that GLS must be used to obtain a correct trend-surface formula.

• Thin-plate spline interpolation with R

Shows how to fit a surface (as in the trend surface) but adjusting to local observations (as in kriging) using 2-D smoothing splines. This is useful if one wants to quickly obtain a clear map showing the main features of the variable, without the model assumptions of trend surfaces or kriging.

• Areal Data and Spatial Autocorrelation R

This tutorial gives an overview of spatial analysis of areal data, that is, attributes of polygonal entities on a map. Typical examples are political divisions, census tracts, and ownership or management parcels. The attribute relates to the whole area of the polygon, and can not be further localized.

• Exercise: Exploratory Data Analysis with GeoDa

GeoDa is an open-source program, cross-platform program designed as a simple tool for exploratory spatial data analysis (ESDA) and some spatial modelling of spatial polygon data, that is, maps of polygon units such as census tracts or political divisions with a set of attributes measured on each one. This uses a portion of the 8-county data of the R exercise (see item just above).

• Point-pattern analysis with R

This tutorial gives an overview of spatial point-pattern analysis. This considers the distribution of one or more sets of points in some bounded region as the result of some stochastic process which produces a finite number of “events” or “occurrences”.

• Optimal partitioning of soil transects with R

Applies the split moving window approach to optimally partition linear series of observations to find “natural” boundaries.

1