0

I am trying to do kriging in geoR for a fairly large area (~1 million km^2). It is for my thesis, so unfortunately I cannot share the data. I have already checked for duplicated in the coordinates and the actual data to see if this is why there is an error in solve. I have tried different ways of writing the trend, e.g. long-hand or by "2nd". I have seen similar errors written about but they have all been regression modelling examples. My "test.geo" data is in order with coordinates and the data together and my variogram works. So I know the initial part of the .geo data is working, the kriging component of my model just doesn't want to work.

My code is:

    my.bdr <- map.shp2@polygons[[1]]@Polygons[[1]]@coords
    x <- my.bdr[,1]
    y <- my.bdr[,2]
    krige.grid <- expand.grid(seq(min(x), max(x), l=1000), 
                      seq(min(y), max(y), l=1000))
    test.ply <- as.matrix(cbind(x, y))   
    test <- krige.conv(test.geo, 
                 krige = krige.control(
                   type.krige = "OK",           
                   trend.d = trend.spatial(~ 1 + test.geo$coords[,1] + test.geo$coords[,2] 
                                           + I(test.geo$coords[,1]* test.geo$coords[,1]) 
                                           + I(test.geo$coords[,1]*test.geo$coords[,2])
                                           + I(test.geo$coords[,2]*test.geo$coords[,2])),    
                   trend.l = trend.spatial(~ 1 + krige.grid[,1] + krige.grid[,2] 
                                           + I(krige.grid[,1]* krige.grid[,1]) 
                                           + I(krige.grid[,1]*krige.grid[,2])
                                           + I(krige.grid[,2]*krige.grid[,2])), 
                   obj.model = test.svm),
                 locations = krige.grid, borders=test.ply)

I keep getting this error:

    Error in solve.default(ttivtt, crossprod(ivtt, as.vector(data))) : 
    system is computationally singular: reciprocal condition number = 4.81502e-36

I would appreciate any advice or help given to resolve this problem! Thanks!

mcgill
  • 1
  • 1

1 Answers1

0

It's an old topic but maybe someone finds useful. What CRS are you using? If you are using UTM try dividing the coordenates by 1000. That's the solution proposed by the creator of the package. It worked for me with lineal trend (not with 2nd polinomial trend)

Ale
  • 1
  • 2