[R-sig-Geo] Problem about ST kriging in gstat
Saman Monfared
samanmonfared1 at gmail.com
Sat Jan 11 10:12:38 CET 2014
Dear list,
I try to ST modeling of TB incidence rate in 38 center on 6 years.
My problem is all ST predictions values
are equal for all points of space and time except the first timelag. I
have examined this program for some another data set but the problem
remains.
All reqires data and program are attached.
rm(list=ls())
library("gstat")
library("spacetime")
dd<-read.table("TBincidencerate1.txt",header=T)
loc<-read.table("kashmarloc.txt",header=T)
coordinates(loc) = ~x+y
dd$time = ISOdate(dd$year,dd$mounth,dd$day,0)
stations = 4:41
w=STFDF(loc,dd$time,data.frame(values = as.vector(t(dd[stations]/12))))
gg<-read.table("point.pred.TB.txt",header=T)
grd = SpatialPixels(SpatialPoints(gg))
plot(grd)
tgrd = seq(min(index(w)), max(index(w))+2*360*24*3600,length=6)
tgrd
library(lattice)
pred.grd = STF(grd, tgrd)
plot(pred.grd )
vv<-variogramST(values ~ 1,w,tlags=0:15,cutoff=55000)
plot(vv,map=F,np=TRUE,cex=1,lwd=1.5,pch=19)
wireframe(gamma~spacelag+timelag,vv,drape =T,scales=list(arrows=F,
mai=c(4,5,2,2)),zlab=expression(gamma),
,light.source = c(10,0,10))
separableModel <- vgmST("separable",space=vgm(.23,"Hol",5000,.77),
time =vgm(.84,"Hol",150,0), sill=20)
wireframe(model~spacelag+timelag,variogramSurface(separableModel,vv),
drape =T,light.source =c(10,0,10),scales=list(arrows=F))
ff<-fit.StVariogram(vv,separableModel, method ="L-BFGS-B",wles =T)
ff
# range.s nugget.s range.t nugget.t sill
#4999.9993501 0.7498763 150.0034786 0.2262177 14.0396906
wireframe(model~spacelag+timelag,variogramSurface(ff,vv),drape =T,
,light.source = c(10,0,10),scales=list(arrows=F),
zlab=expression(gamma),main="fitted variogram ")
TB.ST = krigeST(values~1,w,pred.grd,ff)
stplot(TB.ST)
Thanks.
Saman.
--
Saman Monfared
Msc, Department of Statistics, Shiraz University,
Shiraz 71454, Iran
Email: Samanmonfared1 at gmail.com
Tel: +98 917 5305167
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ST-TB.rar
Type: application/rar
Size: 11202 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140111/63762a06/attachment.bin>
More information about the R-sig-Geo
mailing list