[R-sig-Geo] gstat error: singular matrix in function LDLfactor()

karl.sommer at dpi.vic.gov.au karl.sommer at dpi.vic.gov.au
Thu Jul 27 04:17:06 CEST 2006


When performing ordinary kriging under gstat in R I received the following
error after the program had stopped.

---R output
vert.ok <- krige(vert~1, em38a, SPDF, model=vert.fit)
[using ordinary kriging]

"chfactor.c", line 130: singular matrix in function LDLfactor()

gstat caught an error that occurred in the matrix library,
the reason for it was: singular matrix

HINT: Read the manual at http://www.gstat.org/ ;
look for: Trouble shooting -> Error messages -> From meschach

"chfactor.c", line 130: singular matrix in function LDLfactor()
Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim,  :
      matrix library error: gstat: matrix library error: singular matrix
---end R output

after consulting the gstat manual I found the following reference:

"These two error messages may occur (a) during simulation, when an
observation falls almost exactly at a simulation location (b) when two
observations occur at identical location occur and noaverage was defined in
its data definition. Solution to (a): increase the value of zero, to (b):
remove the noaverage. Read also the next section."

My input file was converted from lat/long to UTM using spTransform.  The
sampling density is quite high and it is possible that after conversion
from latlong to UTM because of rounding some measurements fall on identical
coordinates.  Is this a possible explanation for the error?

The GSTAT online manual suggests to remove "noaverage" or increase "zero"
to overcome the problem. However, I have not figured out how to do this
when running gstat under R.

Should I use only a subset of the orignial data or are there other
alternatives to overcome the problem?

Regards

Karl

_________________________________
Karl J Sommer,
Department of Primary Industries,
Catchment & Agriculture Services,
PO Box 905
Mildura, VIC, Australia 3502

Tel: +61 (0)3 5051 4390
Fax +61 (0)3 5051 4534

Email:     karl.sommer at dpi.vic.gov.au




More information about the R-sig-Geo mailing list