Lab 2: Variogram Estimation


Getting Started with R

Click on the R icon

If no R icon, go to the C drive and the Programs folder to find R or search for R


Example 1: The Omnidirectional Variogram

The R gstat function variogram>

we will need to load the R package gstat .

> help(variogram)

Let's read the coal ash data into a R dataset:

> coal.ash <- read.table("http://www.rohan.sdsu.edu./~babailey/stat696/coal.ash.txt", header=T)

It is also necessary to make x and y the coordinates:

> coordinates(coal.ash) <- c("x", "y")

Let's make a lagged scatter plot for the coal ash data:

This is scatter plot of pairs Z(s_i) and Z(s_j), grouped according to to their separation distance.

> help(hscat)

> hscat(coal ~ 1, data=coal.ash, breaks=c(0,5,10,15))

Let's look at sample code in variogram1.r

To make the plots copy and past the code into R OR just source the code:

Here is is information on the robust estimator robustvariogram.pdf


Example 2: The Directional Variogram

Let's look at sample code in variogram2.r

To make the plots copy and past the code into R OR just source the code: