Skip to content
Prev 10389 / 29559 Next

help with Ordinary Kriging with R (singular matrix error)

I tried to go ahead to fix my problem with R and Kriging ..

as the example i tried produce a bad varuiogram fitting (maybe my fault)
i tried the package automap using the following sintax :



d <- read.csv('/home/habcam/scl.csv')
e <- na.omit(d)
coordinates(e) <- ~ x+y
variogram = autofitVariogram(scallop_de~1,e)
plot(variogram)
x.range <- as.integer(range(e at coords[,1]))
y.range <- as.integer(range(e at coords[,2]))
grd <- expand.grid(x=seq(from=x.range[1], to=x.range[2], by=300),
y=seq(from=y.range[1], to=y.range[2], by=300) )
gridded(grd) =~ x+y

kriging_result = autoKrige(scallop_de ~ 1, e, grd)
Warning in autoKrige(scallop_de ~ 1, e, grd) :
  Removed 2018 duplicate observation(s) in input_data:
              coordinates   cat scallop_de
2       (677919, 4546180)     2       2.05
20      (678847, 4545330)    20       2.02
59      (682175, 4541480)    59       0.81
...
...
...
21808   (684423, 4591090) 21808       1.35
21810   (684417, 4591090) 21810       1.71
21815   (684396, 4591090) 21815       1.53
21821   (684346, 4591090) 21821       1.06
21827   (684249, 4591090) 21827       2.66
21948   (699146, 4595160) 21948       1.42
[using ordinary kriging]




but R start to think ... and nver ends, after more than 1 hour i killed
the process :-( 

have you any suggestion on how can i "krige" my data [1] ?

 [1] files.me.com/epiesasha/ynl85n



i also tried a different approach using :

mydata <- read.csv("file.csv")
library(sp)
coordinates(mydata) <- c("x","y")
library(rgdal)
writeOGR(obj=mydata,driver="ESRI Shapefile",dsn=".",layer="mydata")


library(gstat)
library(rgdal)
mydata <- readOGR(dsn=".",layer="mydata")
plot(variogram(mydata at data$scallop_de~1,mydata, cloud=TRUE))

the last line produce an R crash ... after freezed the computer.


are 25000 points too mutch data for R ?
On Tue, 2010-12-14 at 15:34 -0500, Massimo Di Stefano wrote: