[R-sig-Geo] Problem about ST kriging in gstat
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sat Jan 11 21:48:36 CET 2014
I re-ran your analysis, and see nothing strange; predictions vary over
space and time. Maybe you work with old(er) versions of packages? (It
seems so: newer versions of gstat require you to add a library(sp) on
the top of the script)
On 01/11/2014 10:12 AM, Saman Monfared wrote:
> 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.
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140111/bac1167b/attachment.bin>
More information about the R-sig-Geo
mailing list