Professional Documents
Culture Documents
DB 6
DB 6
################################################
# Empirical variograms with the gstat library
#
# Set path
library(gstat)
# attach the data set 'meuse' (soil concentrations from the Meuse
# River flood plain near the village Stein). This data set is
# included in the 'gstat' library so it is available after you
# load the library.
data(meuse)
# see what's in it
names(meuse)
# Make a 'bubble plot' of the cadmium data. Dots at (x,y), area of each
# dot identifies its concentrations.
#
# The first entry is the data frame (meuse) containing the x,y, and z values,
#
# "xcol", "ycol", "zcol" give the names of the x,y,z values (in quotes),
#
# "main" is the title for the plot
#
# "key.entries" identifies the cutoff values for circle sizes....basically
# gives the circle sizes to use.
#
#"maxsize" is the size of the biggest cirle.
# See helpfile for more options...
postscript(paste(path,"cadbubble.ps",sep=""),paper="letter",horiz=T)
bubble(meuse, xcol="x",ycol="y",zcol="cadmium",
maxsize = 2.5, main = "cadmium concentrations (ppm)",
key.entries = c(.5,1,2,4,8,16))
dev.off()
postscript(paste(path,"zincbubble.ps",sep=""),paper="letter",horiz=T)
bubble(meuse, xcol="x", ycol="y", zcol="zinc",
main = "zinc concentrations (ppm)",
key.entries = 100 * c(1,2,4,8,16))
dev.off()
postscript(paste(path,"zincQQ.ps",sep=""),paper="letter",horiz=T)
par(mfrow=c(2,2))
hist(meuse$zinc)
qqnorm(meuse$zinc)
# log(zinc) normal?
hist(log(meuse$zinc))
qqnorm(log(meuse$zinc))
dev.off()
data(meuse)
print(logzinc.var)
postscript(paste(path,"logzincvgram.ps",sep=""),paper="letter",horiz=T)
plot(logzinc.var)
dev.off()
web1.sph.emory.edu/users/lwaller/book/ch8/db6.r 2/2