EmpiricalVariogram
calculates the empirical (semi-)variogram
of a random field realisationEmpiricalVariogram(x, y=NULL, z=NULL, T=NULL, data, grid, bin,
gridtriple=FALSE, phi, theta, deltaT)
data
has a multiple
number of components as expected by the definition of the
coordinates then it is assumed that the data stem from repeated,
independent measurements at the given locations; the empirTRUE
then
x
, y
, and z
define a grid; otherwise
x
, y
, and z
are interpreted as pointsgrid=TRUE
.
If gridtriple=TRUE
then x
, y
, and z
are of the
form c(start,end,step)
; if
gridtriple=FALSE
then x
,T[3]
.(length(bin)-1)
.data
: the number of values must match the number of
points (given byx
,y
,z
,grid
, andgridtriple
). That is, it must equal the number of points or be
a multiple of it. In case the number of data equals$n$times the
number of points, the data are interpreted as$n$independent
realisations for the given set of points.(grid=FALSE)
: the vectorsx
,y
, andz
, are interpreted as
vectors of coordinates(grid=TRUE) && (gridtriple=FALSE)
: the vectors \
code{x},y
, andz
are increasing sequences with identical lags for each sequence.
A corresponding
grid is created (as given byexpand.grid
).(grid=TRUE) && (gridtriple=TRUE)
: the vectorsx
,y
, andz
are triples of the form (start,end,step) defining a grid (as given byexpand.grid(seq(x$start,x$end,x$step),
seq(y$start,y$end,y$step),
seq(z$start,z$end,z$step))
)length(bin)
$-1$.
Hence, to include zero,bin[1]
must be negative.RandomFields
#############################################################
## this example checks whether a certain simulation method ##
## works well for a specified covariance model and ##
## a configuration of points ##
#############################################################
x <- seq(0, 10, 0.5)
y <- seq(0, 10, 0.5)
gridtriple <- FALSE ## see help("GaussRF")
model <- "whittle" ## whittlematern
bins <- seq(0, 5, 0.001)
realisations <- 5 ## by far too small to get reliable results!!
## It should be of order 500, but then it will
## take some time to do the simulations
param <- c(mean=1, variance=10, nugget=5, scale=2, alpha=2)
f <- GaussRF(x=x, y=y, grid=TRUE, gridtriple=gridtriple,
model=model, param=param, method="TBM3",
n=realisations)
binned <- EmpiricalVariogram(x=x, y=y, data=f, grid=TRUE,
gridtriple=gridtriple, bin=bins)
truevariogram <- Variogram(binned$c, model, param)
matplot(binned$c, cbind(truevariogram,binned$e), pch=c("*","e"))
##black curve gives the theoretical values
Run the code above in your browser using DataLab