[R-sig-Geo] I've a problem with krige and would appreciate any thoughts...

Peter S. Hayes pshayes at maine.rr.com
Mon Apr 20 00:14:06 CEST 2009


Hello list,

I have some data I am attempting to krige as an example for my class to 
perform.

Most of the work has been reading in, reprojecting, and formatting 
data... all fine.

But, when I create the variogram, grid, and variogram model and pass 
these into fit.variogram, I receive an error that - on the surface - 
seems to make no sense.

I considered that the singular variogram model might be the problem, but 
that made no difference when changed. I'm puzzled... any thoughts?

Thank you all!



Pete Hayes


str(fishtr)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 364 obs. of 8 variables:
.. ..$ X : int [1:364] 1 2 3 4 5 6 8 9 10 11 ...
.. ..$ Cruise_Tow: int [1:364] 199402 199402 199402 199402 199402 199402 
199402 199402 199402 199402 ...
.. ..$ YearNo : int [1:364] 0 0 0 0 0 0 0 0 0 0 ...
.. ..$ NUMBER : int [1:364] 2 19 12 10 1 12 18 8 23 7 ...
.. ..$ WEIGHT_KG : num [1:364] 0.9 2.2 2 2.4 0.5 0.8 1.7 1.2 3.6 1.9 ...
.. ..$ DSaco : num [1:364] 164743 156002 152330 167741 179798 ...
.. ..$ IDSaco : num [1:364] 6.07e-06 6.41e-06 6.56e-06 5.96e-06 5.56e-06 ...
.. ..$ lwt : num [1:364] -0.105 0.788 0.693 0.875 -0.693 ...
..@ coords.nrs : num(0)
..@ coords : num [1:364, 1:2] 421360 415658 432270 462808 460247 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "DECLON" "DECLAT"
..@ bbox : num [1:2, 1:2] 347047 4641166 595022 4902398
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "DECLON" "DECLAT"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr " +proj=utm +zone=19 +ellps=GRS80 +datum=NAD83 
+units=m +no_defs +towgs84=0,0,0"
 > str(vg)
Classes ‘gstatVariogram’ and 'data.frame': 15 obs. of 6 variables:
$ np : num 490 1120 1758 2125 2678 ...
$ dist : num 5126 12320 20132 28176 36059 ...
$ gamma : num 1.18 1.48 1.33 1.52 1.6 ...
$ dir.hor: num 0 0 0 0 0 0 0 0 0 0 ...
$ dir.ver: num 0 0 0 0 0 0 0 0 0 0 ...
$ id : Factor w/ 1 level "var1": 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "direct")='data.frame': 1 obs. of 2 variables:
..$ id : Factor w/ 1 level "var1": 1
..$ is.direct: logi TRUE
 > str(vg.fit)
Classes ‘variogramModel’ and 'data.frame': 2 obs. of 9 variables:
$ model: Factor w/ 19 levels "Nug","Exp","Sph",..: 1 3
$ psill: num 0.698 0.761
$ range: num 0 10342
$ kappa: num 0 0.5
$ ang1 : num 0 0
$ ang2 : num 0 0
$ ang3 : num 0 0
$ anis1: num 1 1
$ anis2: num 1 1
- attr(*, "singular")= logi TRUE
- attr(*, "SSErr")= num 2.16e-07
 > str(spgrid)
Formal class 'SpatialGrid' [package "sp"] with 5 slots
..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
.. .. ..@ cellcentre.offset: num [1:2] 347046 4641165
.. .. ..@ cellsize : num [1:2] 1000 1000
.. .. ..@ cells.dim : int [1:2] 255 265
..@ grid.index : int(0)
..@ coords : num [1:2, 1:2] 347046 601046 4641165 4905165
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
..@ bbox : num [1:2, 1:2] 346546 4640665 601546 4905665
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..@ projargs: chr " +proj=utm +zone=19 +ellps=GRS80 +datum=NAD83 
+units=m +no_defs +towgs84=0,0,0"
 >
 > lwt.uk <- krige(lwt~IDSaco,fishtr,spgrid,vg.fit)
Error in eval(expr, envir, enclos) : object "IDSaco" not found
 >



More information about the R-sig-Geo mailing list