7. Introduction to geostatistics and variograms

7.1 Link all pairs of points [Demo] (download)

Generate locations of a random dataset and connect all pairs of points. This demostrates the strategy behind the calculation of variograms, combine all pairs of points.

- npoints <- 25 # number of locations to randomly generate
- sizePOINTS <- 1 # size of the point symbol in the graphical repreentation
- colour <- rgb (1,0,0,0.5) # colour of the representation 

7.2 H-scatterplots (download)

Compute and display H-scatterplots, or self scatterplots of a unique variable measured at several locations. Each plot displays the values of the variable at a specific location and the values of the same variable at another location separared by a distance within and interval. For each plot a Pearson correlation coeficient is computed and at the end Correlation variations along distance (correlogram) is also plotted.

- varcolXY <- c(1,2) # indexes of the coordinates X and Y in the GTD data frame
- varlistindex <- 11 # index of the GTD data frame variable
- ndecimals <- 3 # number of decimal places
- lag <- 25 # spacing of each interval of distances
- n.plots <- 8 # number of H-scatterplots to compute and display
- sizePOINTS <- 0.75 # size of the points in each Hscatterplot
- titleGRAPH <- "H-scatterplots and correlogram" # title of the graphic

7.3 Experimental variograms 1D (download)

Compute experimental variograms for a list of values at 2D. Values are imported from an ASCII datafile. Left graphic display the location and the values. Right graphic represents the experimental variogram and the number of pairs of points of each value.

- fileNameGrid="C:/temp/DemoGrid1d.prn" # name of the data file contains a list of values (grid 1D)
- fileNameMOD="C:/temp/Demogrid1D.MOD" # name of the file storing the experimental variogram to fit in scripts 7.10 or 7.11
- xmincenter=0 # X coordinate of the first point
- ncellsx <- 12 # number of cells (values) in X direction
- ncellsy <- 1 # number of cells (values) in Y direction
- cellsizex=2 #spacing between values
- titleX="Coordinate X" #title of the X axis
- legendaeixoX="Distance (year)" # title of the 
- titleGRAPH="Water depth"

7.4 Experimental variograms 2D (grids) (download)

Draw one or several box-plots in the same graphic.

- varlistindex <- c(5:11) # indexes of the GTD frame variables
- plotlog=FALSE # log scale (FALSE or TRUE)
- titleGRAPH <- "Box-plots das variáveis em estudo" #title of the graphic

7.5 Plot theoretical models of variograms (download)

Plot several different theoretical models of variograms in the same plot for sake of comparison.

- varlistindex <- c(5:11) # indexes of the GTD frame variables
- ndecimals <- 3 # number of decimal places

7.6 Plot theoretical ellipses of ranges (download)

Compute and display intervals and number of individuals of the 1st and 2nd order outliers (left and right) for one or several quantitative variables. 

- varlistindex <- c(5:11) # indexes of the GTD frame variables
- ndecimals <- 3 # number of decimal places

7.7 Azimuth angles histogram for 2D scattered data (download)

Display an histogram (simple and cumulative) and the box-plot of one quantitative variable.

- nclasses <- 10 # number of histogram classes
- varlistindex <- 5 # index of the GTD frame variable
- absfrequency <- TRUE # absolute or relative frequencies
- colour <- rgb(0,0,1,0.5) # histogram color (0 to 1) levels of red, green, blue and transparency

7.8 Demonstrate the selection of pairs of points for scattered data (download)

Plot two histograms of two quantitative variables in the same graphic. 

- nclasses <- 20 # number of histogram classes
- varlistindex <- c(10,11) # index of the two GTD frame variable
- varunits <- c("(ppm)","(ppm)") #units of the variables
- linedensity <- FALSE  # add line of density 
- titleGRAPH <- "Histograms" # global title
- maxY=0.025 # maximum frequency of the graphic
- colour <- c(rgb(0,0,1,0.5),rgb(1,0,0,0.5)) # histogram colors (0 to 1) levels of red, green, blue and transparency (two colours)

7.9 Experimental variograms for 2D scattered data (download)

Draw a stem and leaf graphic.

-    varlistindex <- 11 # index of the GTD frame variable

7.10 Fit theoretical models of variograms (fit for each direction) (download)

Plot a bar or pie diagram for one qualitative variable.

- histtype=2 # option for Pie (1) or Bars (2)
- varlistindex <- 4 # index of the GTD frame qualitative variable
- colour <- rgb(0,0,1,0.5) # histogram colors (0 to 1) levels of red, green, blue and transparency (for bars only)

7.11 Fit theoretical models of variograms (fit ellipse) (download)

Plot and compare arithmetic, harmonic and geometric means.

- varlistindex <- 11 # index of the GTD frame variable
- ndecimals <- 3 # number of decimal places