[R-sig-Geo] Large Prediction Variances with gstat

Jesse Berman berman.jesse at gmail.com
Thu Feb 28 22:20:26 CET 2013


Hi All,

First time post, so please excuse any omissions/confusion.  I am performing
a series of prediction models using gstat and discovered that prediction
variance of spatially dependent data with OLS models was larger than those
of kriging models.  This is counter-intuitive to the assumption that
treating spatially dependent data as IID will result in artificially
shrunken prediction variances.  Anyhow, to better understand how gstat
treats OLS predictions, I reproduced an OLS prediction with the base package
('predict' and 'predict.lm') and found that while I got identical beta's, I
got substantially higher variances with gstat.

Can anyone shed some light as to why gstat might be giving these larger
prediction variances when performing an OLS model?  (see reproducible
example below)

Regards and thanks for the help,
Jesse   

library(gstat)
data(meuse)
coordinates(meuse) = ~x+y
meuse.ns<-as.data.frame(meuse) #non-spatial Meuse data

#Data sets for modeling and prediction; spatial and non-spatial
dat.mod<-meuse[1:100,]
dat.pred<-meuse[101:155,]
dat.ns.mod<-meuse.ns[1:100,]
dat.ns.pred<-meuse.ns[101:155,]

#Linear Model Prediction with base package
lm.zn<-lm(log(zinc)~x+y+elev, data=dat.mod)
lm.zn.pred<-predict(lm.zn, dat.pred, se.fit=TRUE)
pred.variance<-(lm.zn.pred$se.fit)^2

#Linear Model Prediction with gstat
gstat.lm.zn.pred<-krige(log(zinc)~x+y+elev, dat.mod, newdata=dat.pred)

#Compare Results
summary(gstat.lm.zn.pred at data) #gstat results
summary(lm.zn.pred$fit)
summary(pred.variance) #base model prediction variance




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Large-Prediction-Variances-with-gstat-tp7582882.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list