[R-sig-Geo] fit.variogram
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Wed May 21 08:15:10 CEST 2008
Could you please provide us with a readable email (see below how yours
looked like to me), and with a reproducable example, so we can look into it?
--
Edzer
PUJAN RAJ REGMI wrote:
> Dear list,
> I tried to fit the model variogram to the experimental semivariogram. I used the following code:
> A<-read.table(file.choose(new=FALSE), sep = "",skip=8,header=FALSE)
> names(A) <- c("x", "y", "B1","B2","B3","B4")
> library(sp)library(gstat)coordinates(A) = ~x+yC<-variogram(B1~x+y+x*y+x*x+y*y,A,cutoff=650,width=12,alpha=0,tol.hor=90)model.1<- fit.variogram(C,vgm(4,"Sph",500,add.to=vgm(1,"Sph",80,nugget=.9)))
> plot(C, model=model.1,pch=1,col="blue",lty =1,lwd=2,plot.numbers=F,xlab=list("Distance(h) [m]",font=1,col="black"),ylab= list(expression("Semivariogram [-]"^2), font=3,col="black"),ylim = c(0,6, by=1), xlim = c(0,650, by=100))
> Using the above code everything went ok. But i need to save the experimental semivariogram i.e (C) and then later utilize it to fit the semivariogram for the same. So I first save it using the following code:
>
> write.table(C, file = "expm-vario.csv", sep = ",", col.names =T,quote=T,qmethod="double")
>
> Then i used the following code to read the saved file expm-vari.csv and try to fit the model for it;
> B<-read.table(file.choose(new=FALSE), sep = ",",skip=0,header=T) class(B)=c("gstatVariogram","data.frame","numeric")model.2<- fit.variogram(B,vgm(4,"Sph",500,add.to=vgm(1,"Sph",80,nugget=.9)))
>
> But I couldn't fit the model. Following was the error message i got:
>
> "Error in fit.variogram(B, vgm(4, "Sph", 500, add.to = vgm(1, "Sph", 80, : REAL() can only be applied to a 'numeric', not a 'integer' "
> The problem seems to be the numeric and integer mismatched but i couldn't figured it out.
>
> any help will be greatly appreciated!
>
> Regards
> Pujan
>
>
>
> _________________________________________________________________
> E-mail for the greater good. Join the i’m Initiative from Microsoft.
>
> ood
> [[alternative HTML version deleted]]
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list