Example R programs
R programs that have been discussed in lab (or in class) are included
here.
- Introduction to R and the sp package
- spIntro.r R code and comments for part 2 (sp package) of the R intro.
- 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 semi-variogram estimation.
- prediction4.r R code and comments for anisotropy and cross validation
- prediction5.r R code and comments for block and non-linear kriging
- plotsvmap.r (Optional) R code for simulating an isotropic Gaussian random
field and plotting the variogram map. Used in 14 Feb lecture.
- areal1.r Construct neighbor lists and weight lists, compute Moran's I and Geary'c and local
Moran's I
- areal2.r Fit OLS, SAR and CAR models to data. Moran's I for residuals from OLS.
- point1.r Describing spatial point processes: estimating G(x), F(x), K(x), and g(x)
- point2.r Non-CSR spatial point processes; fitting Matern Cluster and Strauss (inhibition) processes
- point3.r Estimating intensity and understanding multi-type patterns
- lin mod.r Fitting ANOVA with spatial correlation
- lin mod.sas Fitting ANOVA with spatial correlation in SAS
- papadakis.r OPTIONAL: Calculating Papadakis's covariate (average neighbor residual)
- simulate.r Simulation of Gaussian random fields using matrix operations
- simulate2.r Simulation of Gaussian random fields using functions in RandomFields