Dear Rusers:
 I am using gstat package and met a problem about using krige. I searched
the mailing list, but still cannot solve it.
My sample dataset "testdata" could be downloaded from
http://www.fdsr.cn/en/xzzq.aspx?KID=4 . It includes  a screenshot from
ArcGIS and the sample data. My codes are listed below.
#setwd("F:/tmp_kriging")
library(rgdal); library(gstat)

#read the RASTER data
temp<-readGDAL("testdata.tif")
#convert the RASTER data to POINT data
temp.points<-as(temp,"SpatialPointsDataFrame")
#project the POINT data to UTM50
proj_pts <- spTransform(temp.points, CRS("+proj=utm +zone=50
+datum=WGS84"))
# Generate a new RASTER data (1000m *1000m):
simulate_grd <- expand.grid(x=seq(from=range(coordinates(proj_pts)[,1])[1],
to=range(coordinates(proj_pts)[,1])[2], by=1000),
y=seq(from=range(coordinates(proj_pts)[,2])[1],
to=range(coordinates(proj_pts)[,2])[2], by=1000) )
coordinates(simulate_grd) <- ~ x+y
gridded(simulate_grd) <- TRUE
proj4string(simulate_grd)<-CRS(proj4string(proj_pts))

#-----My problems are as follows.------#
#Method1-Error
# perform ordinary kriging prediction-errors?
v <- variogram(g)
m <- fit.variogram(v,
model=vgm(psill=508074.2,model="Sph",range=16526.37,nugget=0))
plot(v, model = m, as.table=TRUE)
g <- gstat(g, id="band1", model=m)
p <- predict(g,model=m,newdata=simulate_grd)
  It took a very longer time (>20minutes) to get the results. But if I use
ArcGIS to do the krige,which only took several seconds to finish it. In my
"testdata", you can find the parameter used by ArcGIS. Here, i specify them
in R.
*Question1: Is there any method to speed it? For example, to specify
something like the number of nearest observations that will be used for a
kriging prediction.*
*Question**2: Could we specify the parameters of VGM automatically in R?
For example, using the parameters detected by fit.variogram.*

#Method2-Error
m2<-vgm(psill=508074.2,model="Sph",range=16526.37,nugget=0)
p2<- krige(formulat=band1~1,proj_pts,simulate_grd,model=m2,nmax=6)
#Errors function (classes, fdef, mtable):unable to find an inherited method
for function "krige", for signature "SpatialPointsDataFrame",
"SpatialPixels".
#THEN, i tried,
simulate_grd2<-as(simulate_grd,"SpatialPixelsDataFrame")
p2<- krige(formulat=band1~1,proj_pts,simulate_grd2,model=m2,nmax=6)
 #Still, get the same error as above.

*Question**3: what's wrong with my above codes?*
*  *I appreciate your time to think about my questions.

-- 
With Kind Regards,

oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[***********************************************************************]
ZhiJie Zhang,MD,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epistat@gmail.com
[***********************************************************************]
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::

	[[alternative HTML version deleted]]

