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


	[[alternative HTML version deleted]]


