# \donttest{
library(spm)
data(petrel)
data(petrel.grid)
gravel <- petrel[, c(1, 2, 6:9, 5)]
longlat <- petrel[, c(1, 2)]
model <- log(gravel + 1) ~ lat + bathy + I(long^3) + I(lat^2) + I(lat^3)
y <- log(gravel[, 7] +1)
glmidwpred1 <- glmidwpred(formula = model, longlat = longlat, trainxy = gravel,
y = y, longlatpredx = petrel.grid[, c(1:2)], predx = petrel.grid, idp = 2,
nmaxidw = 12)
# Since the default 'family' is used, actually a 'lm' model is used.
names(glmidwpred1)
# Back transform 'glmidwpred$predictions' to generate the final predictions
glmidwpred1$predictions.bt <- exp(glmidwpred1$predictions) - 1
range(glmidwpred1$predictions.bt)
# }
Run the code above in your browser using DataLab