Can regression and IDW spatial interpolation be done in one model in R? -
i spatial modelling of variable t (temperature). use commonly used in literature - perform regression (using variables altitude etc.) , spatially interpolate residuals using idw. r package gstat seems have option:
interpolated <- idw(t ~ altitude, stations, grid, idp=6) spplot(interpolated["var1.pred"])
but in documentation of idw()
write:
function idw performs [...] . don't use predictors in formula.
and actually, result looks if regression performed, without spatial interpolation of residuals. know can manually:
m1 <- lm(t ~ altitude, data = data.frame(stations)) tres <- resid(m1) res.int <- idw(tres ~ 1, stations, grid, idp=6) tpred <- predict.lm(m1, grid) spplot(spatialgriddataframe(grid, data.frame(t = tpred + data.frame(res.int)['var1.pred'])))
but have many drawbacks - model not in 1 object, cannot directly summary, check deviance, residuals , importantly, crossvalidation... have done manually. so,
is there way how regression , idw in 1 model in r?
note don't want use different method of spatial interpolation, because idw used in area of modelling , tested these purposes.
so want regression first, , perform idw on residuals. cannot done in 1 go, both theoretical , software point of view:
- theoretical, kriging presents unified way of treating both model , residuals in 1 go using linear model , create prediction, i.e. linear regression spatially correlated residuals. in case of hybrid model, theoretical frame not present. because of ad hoc nature not recommend doing this.
- practically, gstat not support doing in 1 go.
i'd recommend going kriging, established , published method. if has not been used in area of expertise, time introduce it. have @ tps
function in fields
package.
some years wrote a technical report dutch meteorological office might of interest you, deals interpolation of evaporation.
Comments
Post a Comment