Description Usage Arguments Value See Also Examples
Return the prediction of a local regression model using region of influence (ROI). The residuals are further predicted using kriging or thin plate spline.
1 2 |
form |
Formula defining the trend. |
x |
Data for trainging the model. |
xnew |
Data at new locations. Validation set. |
nk |
Size of the neighborhoods. |
loc |
Formula. Covariates of the similarity between sites (euclidean distance). Used for delineation. |
grp |
Factor defining groups for calibrating |
model |
Model for predicting the residuals. Could be 'tps' or a vector of variogram models. See vgm. |
loc.spatial |
Formula defining the spatial covariates (euclidean distance). Used for predicting residuals with spatial correlation. |
ker |
Logical, should weight be used to favor closer sites. |
... |
pred |
Prediction at new sites. |
pred.se |
Standard deviation at new sites. |
trend |
Part of the prediction attributed to trend |
trend.se |
Standard deviation associated with the trend |
fitted |
Fitted values (training sites) |
fitted.se |
Standard deviaton of the fitted values |
vgm |
Sample variogram. |
model |
Fitted variogram model. See vgm. |
gamKrige, nnKrige
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 | # 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
l1Form <- l1 ~ area + slope + elev + map + len + wb
nform <- ~ area + slope + elev + map + len + wb
# Using kriging
fit <- roiKrige(l1Form, x = xd[train,], xnew = xd[valid,],
n = 50, ker = TRUE,
model = c('Exp','Gau','Sph'),
loc = nform, loc.spatial = ~lon+lat)
print(fit)
plot(fit)
predict(fit)
# Without spatial component
fit <- roiKrige(l1Form, x = xd[train,], xnew = xd[valid,],
n = 20, ker = FALSE, model = 'none', loc = nform)
# Using Thin plate spline
fit <- roiKrige(l1Form, x = xd[train,], xnew = xd[valid,],
n = 20, loc = nform, model = 'tps',
loc.spatial = ~lon+lat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.