### first example
### load data
data(meuse,meuse.blocks)
### plot blocks
plot(meuse.blocks)
### compute the approximated block variance of each block in meuse.blocks
### without the definition of neighbours blocks (default) for an exponential
### covariance function without a measurement error, a nugget = 0.15 (micro
### scale white noise process) and a scale parameter = 192.5
preCK_1 <- preCKrige(newdata = meuse.blocks, model = covmodel(modelname =
"exponential", mev = 0, nugget = 0.05, variance = 0.15,
scale = 192.5), pwidth = 75, pheight = 75)
### plot block approximation of block 59
plot(preCK_1, 59)
### second example
### define neighbours by using the poly2nb function
### of the spdep package
if(require(spdep))
{
neighbours <- poly2nb(meuse.blocks)
class(neighbours)
### neighbours should be an object of the class "list"
class(neighbours) <- "list"
### compute the approximated block variance-covariance matrices of each block in
### meuse.blocks without the defined block neighbours
preCK_2 <- preCKrige(newdata = meuse.blocks, neighbours = neighbours,
model = covmodel("exponential", 0.05, 0.15, scale = 192.5),
pwidth = 75, pheight = 75)
### plot block approximation of block 59 and its
### block neighbours
plot(preCK_2, 59)
}
if(!require(spdep))
{
cat("Please, install the package spdep to execute this example.
")
}
Run the code above in your browser using DataLab