Description Usage Arguments Value See Also Examples
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.
1 |
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. |
pred |
Prediction at new locations. |
pred.se |
Standard deviation at new locations. |
vgm |
Sample variogram. |
model |
Fitted variogram model. See vgm. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.