[R-sig-Geo] kriging variance vs sample spacing
Kerry Ritter
kerryr at sccwrp.org
Fri Apr 29 20:37:45 CEST 2011
Hi I want to compute the kriging variance as a function of grid spacing
so that I can measure cost vs. kriging variance in deciding on an
appropriate grid spacing for an ocean sediment surrounding an outfall.
From an earlier study I have a response with an anisotropic variogram
given by model=vgm(0.37108, "Gau", 4500, anis = c(0, 0.75)). The
sampling area is a polygon. To compute this curve, I have created a
series of shapefiles containing the polygon with different grid
spacings. I want to compute the kriging variance for each grid spacing
so I can plot it on the y-axis and grid spacing on the x-axis.
I have tried the following code: I have been using the library gstat
and geoR
names(SD1000) # shape file that contains a 1000 x
750 sampling grid (in therms of UTM coordinates) - this is what I wan to
find the associated kriging variance
g.dummy <- gstat(formula = z~1, locations= ~lon_UTM+lat_UTM, dummy =
TRUE, beta = 0,
model = vgm(0.37108, "Gau", 4500, anis = c(0,
0.75))) #variance model from earlier survey
BRI1000 <- predict(g.dummy,newdata=SD1000, nsim = 1)
BRI1000
#sampling grid of 1000 x 750 simulated values
SD100.spdf=SD100
# shape file that contains a dense grid resolution (153 x 100m) polygon
coordinates(SD100.spdf)=~lon_UTM+lat_UTM
class(SD100.spdf)
head(SD100.spdf)
vgm.aniso7=variogram(sim1~1,BRI1000.spdf,
alpha=c(0,90,180,270),boundaries= c(0,300,900,1300,1800,1900,
2300,2800,3000,3500,4000,4500,6000,10000,15000),cressie=TRUE)
vgmaniso.fit7=fit.variogram(vgm.aniso7,vgm(0.37108,model="Gau",range=
4500,anis=c(0,0.75)),fit.sills=c(FALSE,FALSE),fit.range=c(FALSE,FALSE),fit.method=7)
vgmaniso.fit1V.pr=krige(sim1~1,BRI1000.spdf,SD100.spdf,vgmaniso.fit7)
summary(vgmaniso.fit1V.pr)
Coordinates:
min max
lon_UTM 464500 476500
lat_UTM 3606804 3625196
Is projected: NA
proj4string : [NA]
Number of points: 9539
Data attributes:
var1.pred var1.var
Min. :-1.6710 Min. :3.270e-11
1st Qu.:-0.7611 1st Qu.:1.736e-08
Median :-0.3351 Median :1.002e-07
Mean :-0.2340 Mean :2.711e-05 <------- Kriging variance????
3rd Qu.: 0.3641 3rd Qu.:1.098e-06
Max. : 1.4195 Max. :7.022e-03
Thank you in advance for your help.
-Kerry
--
**********************
Kerry Ritter, Ph.D.
statistician
Southern California Coastal Water Research Project
3535 Harbor Blvd., Suite 110
work: 714-755-3210
cell: 714-420-3346
fax: 714-755-3299
email: kerryr at sccwrp.org
More information about the R-sig-Geo
mailing list