Dear author without name,

I have too little information to reproduce your problem, so I can only 
guess. A possibility is that fit.lmc yields variograms that reflect a 
perfect or near-perfect correlation. An option to correct for this is to 
use fit.lmc(..., correct.diagonal = 1.01).

Beyond the gstat manual you'll find information like this on the 
function documentation, e.g. type on the R prompt

? fit.lmc

further, most of the R-spatial and R/gstat-related questions go to the 
r-sig-geo mailing list.
--
Edzer


zhangyang wrote:
>
> Dear everyone,
>
> I am using gstat in R to do cokriging and sequential simulation job 
> with remote sensing data. I can successfully get a good cokriging 
> result but fail to simulation procedure. The error is “"chfactor.c", 
> line 66: matrix not positive definite in function CHfactor()”. I have 
> consulted the gstat manual for this trouble but still have not any 
> improvement. So I want your help urgently! Below are the details about 
> my experiment.
>
> # read the data value of target variable (band6.data,16*16 pixels) and 
> co-variable (band4.data, 32*32 pixels)
>
> band6.data<-read.table ("band6.dat.bak", col.names=c 
> ("x","y","DN6","indicator6"))
>
> band4.data<-read.table ("band4.dat.bak", col.names=c 
> ("x","y","DN4","indicator4"))
>
> # these two variables are stored in a gstat object named “g”.
>
> g<-gstat(id="indicator6",formula=indicator6~x+y+x*y+sqrt(x)+sqrt(y),location=~x+y,data=band6.data)
>
> g<-gstat(g,id="indicator4",formula=indicator4~x+y+x*y+sqrt(x)+sqrt(y),location=~x+y,data=band4.data)
>
> #calculate sample variograms and cross variograms, fit a linear model 
> of coregionalisation to direct and cross variograms and plot the 
> variograms and fitted models.
>
> g<-gstat(g,model=vgm(0.097,"Sph",368,0.002),fill.all=T)
>
> v.cross<-variogram(g)
>
> g <- fit.lmc(v.cross, g)
>
> plot (variogram(g), model=g$model)
>
> #creat newdata=band8.grid using the coordinates of band8.data (64*64 
> pixels) for kriging work.
>
> band8.data<-read.table("band8.dat.bak",col.names=c("x","y","DN8","indicator8"))
>
> band8.grid=band8.data[c("x","y")]
>
> #store two-variable cokriging predictions in k.c.
>
> k.c<-predict.gstat(g, band8.grid)
>
> coordinates(k.c)=~x+y
>
> spplot(k.c["indicator6.pred"])
>
> set.seed(131)
>
> # creat newdata=band8.grid2 using the coordinates of band8.data 
> forsimulation work.
>
> band8.grid2=band8.data[c("x","y")]
>
> coordinates (band8.grid2)=~x+y
>
> #fail to sequential simulation.
>
> band6.sim<-predict.gstat(g, band8.grid2,nmax=16, nsim=1)
>
> Error: "chfactor.c", line 66: matrix not positive definite in function 
> CHfactor()
>
>
>
> ------------------------------------------------------------------------
> [广告] 买房不必东奔西走，上房老大，看"二手房"网上房展会 
> <http://popme.163.com/link/003984_0909_8679.html> 

-- 
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/


	[[alternative HTML version deleted]]


