An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090120/c6e8a3c8/attachment.pl>
OCK in gstat and co-located [SEC=UNCLASSIFIED]
3 messages · Li Jin, Edzer Pebesma
Dear all, One more error:
mud.pred<-predict(mud.ock.fit, newdata=data.file.pred)
non-positive definite coefficient matrix in structure 2Error in predict.gstat(mud.ock.fit, newdata = data.file.pred) : gstat: value not allowed for: variograms do not satisfy a legal model Thanks for any suggestions. Regards, Jin -----Original Message----- From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Li Jin Sent: Tuesday, 20 January 2009 10:31 To: r-sig-geo at stat.math.ethz.ch Subject: [R-sig-Geo] OCK in gstat and co-located [SEC=UNCLASSIFIED] Dear there, I am running OCK for a number of datasets. The codes worked for the first five datasets and then I got an error message: Linear Model of Coregionalization found. Good. [using ordinary cokriging] Linear Model of Coregionalization found. Good. [using ordinary cokriging] Linear Model of Coregionalization found. Good. [using ordinary cokriging] Linear Model of Coregionalization found. Good. [using ordinary cokriging] Linear Model of Coregionalization found. Good. [using ordinary cokriging]non-positive definite coefficient matrix in structure 1Error in predict.gstat(mud.ock.fit, newdata = data.file.pred) : gstat: value not allowed for: variograms do not satisfy a legal model I wonder what caused the problem and how to correct it? Any suggestions are appreciated. Givent that we have data of all secondary variables for each point of interest, I guess this would automatically lead to a co-located OCK. Is this assumption correct? As I remember, Edzer mentioned to use merge parameter to specify this, is there an example for this as a reference if we have to specify this? Thanks in advance. The scripts used are: file.read.dev<-paste(files.path.dev, dev.files[i], sep="") # create the path for the file to be imported in data.file.dev<-read.table(file.read.dev, header=TRUE, sep=",") file.read.pred<-paste(files.path.pred, pred.files[i], sep="") # create the path for the file to be imported in data.file.pred<-read.table(file.read.pred, header=TRUE, sep=",") coordinates(data.file.dev) = ~LON+LAT coordinates(data.file.pred) = ~LON+LAT #gridded require constant coordinate intervals, so we used coordinates instead #mud.ock <- gstat(id="md", formula=sqrt(mud)~1, data=data.file.dev, nmax=20) mud.ock <- gstat(id="md", formula=sqrt(mud)~1, data=data.file.dev) mud.ock <- gstat(mud.ock, "bathy", bathy~1, data.file.dev) mud.ock <- gstat(mud.ock, "dc", dist.coast~1, data.file.dev) mud.ock <- gstat(mud.ock, "sl", slope~1, data.file.dev) mud.ock <- gstat(mud.ock, model = vgm(1,"Sph",5,1), fill.all=T) x <- variogram(mud.ock) mud.ock.fit=fit.lmc(x, mud.ock) mud.pred<-predict(mud.ock.fit, newdata=data.file.pred) #plot(x, model=mud.ock.fit) mud.pred<- as.data.frame(mud.pred) mud.pred$bt.pred<-(mud.pred$md.pred)^2 mud.pred$bt.pred[mud.pred$bt.pred>=100]=100 Regards, Jin _______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Hi Jin, you're not the first to run into this one; read the fit.lmc documentation. fit.lmc fits partial sill matrices that may have perfect correlation among variables. To avoid so, you could instead of
Jin.Li at ga.gov.au wrote:
...
mud.ock.fit=fit.lmc(x, mud.ock)
try: mud.ock.fit = fit.lmc(x, mud.ock, correct.diagonal = 1.01) or a larger value. This gets the correlation down to say .99 instead of 1.0; 1.0 is allowed (I believe) for a LMC, but then you run into trouble when the secondary variable is collocated with the first. There's also ways of avoiding predict.gstat to do this check, but that might lead to trouble further down the pipeline. -- Edzer
mud.pred<-predict(mud.ock.fit, newdata=data.file.pred) #plot(x, model=mud.ock.fit) mud.pred<- as.data.frame(mud.pred) mud.pred$bt.pred<-(mud.pred$md.pred)^2 mud.pred$bt.pred[mud.pred$bt.pred>=100]=100 Regards, Jin
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/ http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de