gamKrige: Prediction at new location using kriging and GAM trend.

Description Usage Arguments Value See Also Examples

Description

The method performs a universal kriging estimate where the trend is described by a generalized additive model (GAM). The trend is not regularized (penalty) and must be chosen parsimoniously.

Usage

1
gamKrige(form, x, xnew, loc, model = c("Exp", "Sph", "Gau"), ...)

Arguments

form

Formula defining the trend of the model.

x

Data for training the model.

xnew

Data at new locations.

loc

Formula defining the coordinates (eulidean distance).

...

Other arguments pass to autoKrige.

Value

pred

Prediction at new locations.

pred.se

Standard deviation at new locations.

vgm

Sample variogram.

model

Fitted variogram model. See vgm.

See Also

nnBagging, roiKrige

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 ## Gather info in on data.frame
 xd <- cbind( l1 = log(sapply(floodStream, mean)),
             floodVars, lon = floodCoord[,1], lat = floodCoord[,2])
 nsite <- nrow(xd)

 ## identify a validation and a training set
 valid <- seq(nsite) %in% sample(seq(nsite), round(.2*nsite))
 train <- !valid

 ## formula of GAM trend using spline
 library(splines)
 l1Form <- l1 ~ area + slope + elev + ns(map, df = 10) +
           ns(len, df = 12) + ns(wb, df = 8)

 fit <- gamKrige(l1Form, x = xd[train,], xnew = xd[valid,], loc = ~lon+lat )
 print(fit)
 plot(fit)
 plotVario(fit)
 predict(fit)

martindurocher/floodRFA documentation built on June 5, 2019, 8:44 p.m.