Stat 406 - Example R programs
R programs that have been discussed in class are included
here.
- 21 Jan 2020: Using sp and drawing maps (optionally, using R)
- 23 Jan: spatial sampling
- simsample.r Illustration of using simulation to evaluate properties of estimators. Non-spatial examples, recreates results from lecture.
- sample.r How to draw random samples of spatial locations. Includes basic information on GrTS sampling. No example of GrTS because of the large amount of spatial information that needs to be set up first.
- 28 Jan: Geostatistical data
- prediction1.r R code and comments for inv. dist. weighting and trend surfaces.
- 6 Feb: Kriging and semivariograms
- prediction2.r R code and comments for ordinary kriging 'by hand'.
- R matrix.pdf Notes on working with matrices in R.
- prediction3.r R code and comments for semivariogram estimation.
- prediction4.r R code and comments for fitting a variogram model and ordinary (simple, universal) kriging
- 13 Feb: Variations on 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
- 20 Feb: Spatial analysis of designed experiments
- alliance.r Analysis of Alliance wheat experiment
- alliance.sas SAS code for analysis of
Alliance wheat experiment
- 25 Feb: areal data
- areal1.r Defining neighbors and estimating spatial correlation.
As R Markdown output and code
- areal3.r Fitting linear models with spatially correlated observations
- areal2.r Join count statistics, Spatial smoothing, emphasizing Gaussian data
- 26 Mar: Point pattern data
- Creating spatial point pattern objects and summary functions:
As an R Markdown file: point1.Rmd
and the output from knitr-ing that file point1.pdf
- Estimating and modeling intensity:
As an R Markdown file: point2.Rmd
and the output from knitr-ing that file point2.pdf
- Simulating and fitting spatial patterns:
As an R Markdown file: point3.Rmd
and the output from knitr-ing that file point3.pdf
- Space-time point pattern analyses:
As an R Markdown file: point5.Rmd
and the output from knitr-ing that file point5.pdf
Other R resources: