Stat 406 - Example R programs

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

• 16 Jan 2018: Using R, using sp, and mapping

• 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

• 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

20,22 Mar: spatial point patterns, part 6

• point1.r Describing spatial point processes: estimating K(x), and g(x); also illustrates G(x), F(x), and J(x)
• point2.r Estimating intensity; summary (max, integral) tests; fitting processes with clustering or inhibition; modeling intensity; bootstrapping point patterns.

• 3 Apr: simulating spatial data, part 7

• 5 Apr: space time data, part 8

• 17 Apr: multi-type point patterns, part 10
Other R resources: