I wish to krige in 2 dimensional and 3 dimensional domain (separately). I have many points, that have been replicated below.
NOTE:
The attribute I wish to krige on is Y. These are intentionally negative since they are exponents values.
The domain is 3D, so from an xy perspective, some of the points seem collocated.
# define kriging domain
x <- sample(seq(0,300,by=5),10,replace=FALSE)
y <- sample(seq(0,300,by=5),10,replace=FALSE)
z <- sample(seq(0,30,by=0.5),100,replace=TRUE)
Y <- sample(seq(-3.0,-0.01,by=0.001),100*10*10,replace=TRUE)
(
mydata = data.frame(x=rep(x,each=10),y=rep(y,times=10),z=z,Y=Y)
grid = data.frame(x=rep(x,times=length(x)),y=rep(y,each=length(y)))
# 2_D Kriging
ok_2D <- krige(formula=Y~1, locations=~x+y, data=mydata, newdata=grid, model=fit.exp)
# 3_D Kriging
ok_3D <- krige(formula=Y~1, locations=~x+y+z, data=mydata, newdata=grid, model=fit.exp)
The error:
> # 2_D Kriging
> ok_2D <- krige(formula=Y~1, locations=~x+y, data=mydata, newdata=grid, model=fit.exp)
[using ordinary kriging]
"chfactor.c", line 131: singular matrix in function LDLfactor()
Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim, :
LDLfactor
>
> # 3_D Kriging
> ok_3D <- krige(formula=Y~1, locations=~x+y+z, data=mydata, newdata=grid, model=fit.exp)
Error in .subset(x, j) : only 0's may be mixed with negative subscripts
>
My question is this: Why is there an issue with a singular matrix? It is my understnading that collocated points should not be an issue in kriging, since the weights will assign a weighting of zero to one of the collocated points.
Or, is there another issue I'm missing? Thanks.