CKrige: Spatial interpolation (2D) by constrained,...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Function for constrained, covariance-matching constrained and universal (external drift kriging) point or block (of any shape) kriging in a global neighbourhood and for isotropic covariance models.

Usage

1
2
3
4
5
6
7
CKrige( formula, data, locations, object, ...)

## S4 method for signature 'formula,data.frame,formula,preCKrigePolygons'
CKrige(formula, data, locations, object, method = 2, ex.out = F)

## S4 method for signature 'formula,data.frame,formula,preCKrigePoints'
CKrige(formula, data, locations, object, method = 2, ex.out = F)

Arguments

formula

formula of the linear regression model in the form response ~ terms of covariates, for ordinary kriging use the formula response ~ 1

data

a data frame with the values of the covariates, the names of the covariates used in the formula object must match the column names of data.

locations

a formula object that describe the coordinates of the data locations (e.g ~ x+y )

object

either an object of the class “preCKrigePolygons” for block kriging or of the class “preCKrigePoints” for point kriging. In general the output object of the preCKrige function.

...

two further arguments to control the spatial interpolation method and the output

method

numeric value to choose the kriging method 1 universal (external drift), method = 2 constrained, method = 3 covariance-matching constrained kriging. By default, method = 2

ex.out

logical value, if ex.out is set TRUE CKrige returns an extended output with additional information, see details for more informations, by default ex.out = F

Details

The CKrige function depends always on a preCKrige output object that contains the parameter of the isotropic covariance model as well as the covariates of the prediction targets.

Value

By default, CKrige returns an object of the class SpatialPointsDataFrame or
SpatialPolygonsDataFrame depending whether the input object for the object argument is of the class “preCKrigePoints” or “preCKrigePolygons”.

The data frame of the returned object contains the following columns independent of the selected kriging method:

prediction

numeric vector with the kriging prediction of the chosen method

prediction.se

numeric vector with the root mean square error (kriging standard error)

The data frame contains 3 additional columns with constrained kriging parameters, if the argument method = 2 of the CKrige function:

sqrt.P

numeric vector with sqrt( Var[ target point or block ] - Var[ fitted values ] )

sqrt.Q

numeric vector with sqrt( Var[ universal kriging predictor ] - Var[ fitted values ] )

K

numeric vector with sqrt.P / sqrt.Q

The data frame contains 3 additional columns with covariance-matching constrained kriging parameters, if the argument method = 3 of the CKrige function:

P1.11

numeric vector, first element of the matrix P1 = ( Cov[target point or block] - Cov[fitted values] )^(1/2)

Q1.11

numeric vector, first element of the matrix Q1 = ( Cov[universal kriging predictor] - Cov[fitted values] )^(1/2)

K.11

numeric vector, first element of the matrix K = O1^-1P1[1,1]



The CKrige function returns a list with the following components if the argument ex.out = T and the argument method is either 1 or 2:

object

either an object of the class SpatialPolygonsDataFrame or
SpatialPointsDataFrame as described above

krig.method

numeric scalar, number of the chosen kriging method 1, 2 or 3.

parameter

list with 2 components. First component beta.coef is the vector with the Generalized Least Square coefficients of the linear regression and the second component cov.beta contains the covariance matrix of the Generalized Least Square coefficients.

sk.weights

if argument method = 1 or method = 2 sk.weights is a matrix with the simple kriging weights. The ith column contains the simple kriging weights of the ith prediction target object. If the argument method = 3 the list component sk.weights is a list. Each list component contains the matrix with the simple kriging weights of the prediction target and its defined neighbours.

inv.Sigma

matrix, inverse covariance matrix of the data

residuals

numeric vector with the Generalized Least Square residuals of the linear regression.


The list of the extended output contains the additional component CMCK.par if the argument method = 3. The CMCK.par component is a list of lists with CMCK parameters, in particular P1 list of the P1 matrices, Q1 list of the Q1 matrices and K list of the K matrices.

Note

print and summary methods for the different CKrige output objects are available.

Author(s)

Christoph Hofer, christoph.hofer@alumni.ethz.ch

References

See main help page of the constrainedKriging package.

See Also

preCKrige

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Not run: 
# load data
data(meuse,meuse.blocks)

# approximation of block variance
# pixel area = 75m x 75m
# exponential covariance function with measurement error = 0, nugget = 0.05,
# part. sill =  0.15 and range parameter = 192.5


preCK=preCKrige(newdata=meuse.blocks,model=
    covmodel("exponential",0,0.05,0.15,192.5),pwidth=75,pheight=75)

# block prediction by constrained kriging on the log scale

CK=CKrige(formula=log(zinc)~sqrt(dist),data=meuse,
locations=~x+y,object=preCK,ex.out=TRUE)

# backtransformation to the original scale for the CK prediction

beta=CK$parameter$beta.coef
M=meuse.blocks@data$M
c1 <-  0.2
c2  <- beta[2]^2 * meuse.blocks@data$M
CK$object@data$Zn=exp(CK$object@data$prediction
+ 0.5*(0.2+beta[2]^2*M-unlist(preCK@covmat)))

# U: upper limits of the relative 95 
# U multiplied by the predictions CK$object@data$Zn gives
# the upper limits of the 95 

CK$object@data$U=exp(CK$object@data$prediction
    +1.96*CK$object@data$prediction.se) /CK$object@data$Zn

# plots with spplot, generic function in the sp package
# the plot shows the constrained kriging predictions on
# the orginal scale
# function ck.colors(n) create a rainbow-like  color vector

breaks <- seq(0, 1850, by = 185)
spplot(CK$object,zcol="Zn",at=breaks,col.regions=ck.colors(10),
colorkey=list(labels=list(at=breaks,labels=breaks)))

# plot of the factor to get the upper bound of the
97.5

breaks=seq(1,3.2,by=0.2)
spplot(CK$object,zcol="U",at=breaks,col.regions=ck.colors(11),
colorkey=list(labels=list(at=breaks,labels=breaks)))

## End(Not run)

constrainedKriging documentation built on May 2, 2019, 4:51 a.m.