krige.conv: cost-based kriging

Description Usage Arguments Examples

Description

All the arguments work as in krige.conv, except the additional arguments dd.dists.mat and dl.dists.mat, which take matrices of distances between observation locations and between observations and prediction locations respectively

Usage

1
2
krige.conv(geodata, coords = geodata$coords, data = geodata$data, locations,
  borders, krige, output, dd.dists.mat, dl.dists.mat)

Arguments

geodata

a list containing elements coords and data as described next. Typically an object of the class "geodata" - a geoR data-set. If not provided the arguments coords and data must be provided instead.

coords

an n x 2 matrix or data-frame with the 2-D coordinates of the n data locations. By default it takes the component coords of the argument geodata, if provided.

data

a vector with n data values. By default it takes the component data of the argument geodata, if provided.

locations

an N x 2 matrix or data-frame with the 2-D coordinates of the N prediction locations, or a list for which the first two components are used. Input is internally checked by the function check.locations.

borders

optional. By default reads the element borders from the geodata object, if present. Setting to NULL prevents this behavior. If a two column matrix defining a polygon is provided the prediction is performed only at locations inside this polygon.

krige

a list defining the model components and the type of kriging. It can take an output to a call to krige.control or a list with elements as for the arguments in krige.control. Default values are assumed for arguments or list elements not provided. See the description of arguments in ‘krige.control’ below.

output

a list specifying output options. It can take an output to a call to output.control or a list with elements as for the arguments in output.control. Default values are assumed for arguments not provided. See documentation for output.control for further details.

dd.dists.mat

n x n symmetric matrix with cost-based distances between observations

dl.dists.mat

m x n matrix with cost-based distances from each observation to each one of the m prediction locations

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
## geodata structure with transformed covariates
data(noise)
if (require(sp)) {
  covarnames=sapply(1:3, function(x) paste("d2TV", x, sep=""))
  obs.df <- data.frame(Leq=obs$Leq,
                       1/(1+(as.data.frame(obs)[covarnames]/20)^2))
  obs.gd <- as.geodata(cbind(coordinates(obs), obs.df),
                       data.col="Leq",
                     covar.col=c('d2TV1','d2TV2','d2TV3'))
  trend=~d2TV1*(d2TV2+d2TV3)

  loc1.df <- as.data.frame(1/(1+(as.data.frame(loc)[covarnames]/20)^2))

  ## fitting variogram models
  vgmdl.std  <- likfit(geodata = obs.gd, trend=trend,
                     ini = c(8,300), cov.model = "matern")
  vgmdl.dmat <- likfit(geodata = obs.gd, trend=trend,
                       ini = c(8,300), cov.model = "matern",
                       dists.mat=dd.distmat)


  # With trend, Euclidean distances
  # NOTE: The Euclidean prediction is done with cost-based covariates
  KC.std = krige.control(trend.d=trend,
                         trend.l=~loc1.df$d2TV1*(loc1.df$d2TV2+loc1.df$d2TV3),
                         obj.model=vgmdl.std)
  kc1.std<-krige.conv(obs.gd,locations=coordinates(loc), krige=KC.std)

  # With trend, Cost-based distances
  KC = krige.control(trend.d=trend,
                     trend.l=~loc1.df$d2TV1*(loc1.df$d2TV2+loc1.df$d2TV3),
                     obj.model=vgmdl.dmat)
  kc1<-krige.conv(obs.gd,locations=coordinates(loc), krige=KC,
                  dd.dists.mat=dd.distmat, dl.dists.mat=dl.distmat)
}

famuvie/geoRcb documentation built on May 16, 2019, 10:04 a.m.