[R-sig-Geo] How to do cross validation for universal krigingin Gstat
Kai Zhang
nitmithv at yahoo.com.cn
Sun Feb 21 21:20:51 CET 2010
Hi Edzer,
Thanks for your quick reply. The primary variable of my interest is temperature. I tried to use krige.cv before, but it did not work. The problem arises because the temperature and impervious surface are from two files. For universal kriging, the krige function has a parameter called "newdata" which handles the second data file. However, the krige.cv does not include a "newdata" parameter according to the help document. There is a error when I specified two datasources when I was running krige.cv in specifying a newdata source:
> dtw.vgm <- variogram(Temp~ Ele, TMP)
> dtw.fit <- fit.variogram(dtw.vgm, model = vgm(1.45, "Exp", 9502,0))
> uk.kriged.am <- krige.cv(Temp~Ele,data=TMP,newdata=IMP,model=dtw.fit)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "krige.cv", for signature "formula", "missing"
I tried to delete parameters names such as 'data' and 'newdata' according to your response to a related problem before in the R-sig-Geo archives. However, it still did not work.
Thanks,
Kai Zhang
======= 2010-02-21 11:51:45 You wrote =======
>Kai,
>
>krige.cv(Temp~Ele, data, model)
>
>should do the job, assuming that your primary variable of interest is
>temperature.
>--
>Edzer
>
>
>Kai Zhang wrote:
>> Dear all,
>>
>> I am attempting several Kriging methods to interpolate temperature in a area. It works well for me to use krige.cv to conduct cross validation for ordinary kriging and gstat.cv for co-kriging. However, I am confused on how to conduct cv for universal kriging. The temperature data is from the data file 1 and the secondary variable with more intense sampling is from another file. Krige.cv does not provide a parameter on 'newdata'. When I was trying gstat.cv, the variogram function automatically fits cross-variogram after I incorporate both temperature and the secondary information into a gstat object. Any suggestions are welcome.
>>
>> g <- gstat(NULL,id="Temp", formula=Temp~1, data=TMP)
>> g <- gstat(g,id="Ele", formula=Ele~1, data=ELE)
>> g <- gstat(g, id = "Temp", model = vgm(1, "Exp", 44559, 1))
>> x <- variogram(g)
>>
>> Many thanks,
>> Kai Zhang
>>
>>
>>
>> __________________________________________________
>> 赶快注册雅虎超大容量免费邮箱?
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>--
>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.52north.org/geostatistics e.pebesma at wwu.de
>
More information about the R-sig-Geo
mailing list