[R-sig-Geo] how to choose best parameters of variogram model in gstat

Jessie Zhang zhyj830515 at 126.com
Fri Mar 23 03:39:20 CET 2012


Edzer, 

Thank you very much. I searched three papers of yours related to automation.
I learned some theoretic knowledge about automatic interpolation. However, I
still confused how to do it in the program.

Now,I am dealing with the package "automap". I have writen a loop program,
but it dosen't work. I attached the dataset of samples
http://r-sig-geo.2731867.n2.nabble.com/file/n7397519/sampledata.csv
sampledata.csv  and predict locations
http://r-sig-geo.2731867.n2.nabble.com/file/n7397519/bj.csv bj.csv . Would
you help me to find out what's wrong with my program? 

Thank you again. 

The program: 

library(gstat) 
library(automap) 

data<-read.csv("sampledata.csv",header=T) 
pred.basis<-read.csv("bj.csv",header=T) 
data$date<-as.Date(data$date) 
day<-unique(data$date) 
length<-length(day) 

pred.data<-matrix(NA, nrow = length(pred.basis[,1]), ncol=length,
byrow=TRUE, 
               dimnames = list(pred.basis$id,day)) 
reshape.data<- reshape(data, v.names="pm10", idvar="station", 
                timevar="date", direction="wide") 

### write a loop to model data 
for (k in 4:13){ 
## compute missing data 
for(i in 1: 27){ 
if (is.na(reshape.data[,k][i]))
reshape.data[,k][i]=mean(reshape.data[,k],na.rm=T) 
} 
coordinates(reshape.data)<-~x+y 
model.auto<-autoKrige(reshape.data[,k],pred.basis) 
} 

The error information is: 
Error in eval(expr, envir, enclos) : object 'pm10.2008' not found 


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/how-to-choose-best-parameters-of-variogram-model-in-gstat-tp7394459p7397519.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list