[GRASS-stats] another gstat error

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 19 15:46:19 EDT 2009


On Fri, 19 Jun 2009, Jarosław Jasiewicz wrote:

> Hi
> Another gstat error:
>
> var.krigged=krige(z~x+y,gr,grid,model=var.fitted)
> [using universal kriging]
>
> "chfactor.c", line 130: singular matrix in function LDLfactor()
> Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim,  :
> LDLfactor

Jarek:

Shall I repeat what I wrote this morning? Did you actually try omitting 
the x+y in the formula? Including a drift in untransformed coordinates is 
very likely to lead to numerical chaos. If z~1 works, then the smoking gun 
is the x+y, isn't it? If you want them, transform them (offset with for 
example elide() in maptools and transform back afterwards).

Roger

>
> I can't imagine the reason
>
> regards
> Jarek
>
> here is structure of my gr spatialPointsDataFrame used in analysis:
>
> str(gr)
> Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
> ..@ data       :'data.frame':    2201 obs. of  5 variables:
> .. ..$ cat: num [1:2201] 2 3 4 5 6 7 8 9 10 11 ...
> .. ..$ naz: Factor w/ 874 levels "1000","1001",..: 874 1 2 3 4 5 6 7 8 9 ...
> .. ..$ x  : num [1:2201] 360175 360176 360178 360169 360167 ...
> .. ..$ y  : num [1:2201] 512736 512736 512733 512719 512712 ...
> .. ..$ z  : num [1:2201] 86.5 87.4 87.7 86.9 86 ...
> ..@ coords.nrs : num(0)
> ..@ coords     : num [1:2201, 1:2] 360175 360176 360178 360169 360167 ...
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : NULL
> .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
> ..@ bbox       : num [1:2, 1:2] 359907 512481 360492 512778
> .. ..- 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=tmerc +lat_0=0 +lon_0=19 +k=0.9993 
> +x_0=500000 +y_0=-5300000 +no_defs +a=6378137 +rf=298.257222101 
> +towgs84=0.000,0.000,"| __truncated__
>
> and newdata grid:
> str(grid)
> Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots
> ..@ data       :'data.frame':    131352 obs. of  1 variable:
> .. ..$ region2: int [1:131352] NA NA NA NA NA NA NA NA NA NA ...
> ..@ grid       :Formal class 'GridTopology' [package "sp"] with 3 slots
> .. .. ..@ cellcentre.offset: Named num [1:2] 359902 512478
> .. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
> .. .. ..@ cellsize         : num [1:2] 1.001 0.998
> .. .. ..@ cells.dim        : int [1:2] 421 312
> ..@ grid.index : int(0)
> ..@ coords     : num [1:2, 1:2] 359902 360322 512478 512788
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : NULL
> .. .. ..$ : chr [1:2] "x" "y"
> ..@ bbox       : num [1:2, 1:2] 359901 512477 360323 512789
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : chr [1:2] "x" "y"
> .. .. ..$ : chr [1:2] "min" "max"
> ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
> .. .. ..@ projargs: chr " +proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 
> +x_0=500000 +y_0=-5300000 +no_defs +a=6378137 +rf=298.257222101 
> +towgs84=0.000,0.000,"| __truncated__
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the grass-stats mailing list