[R-sig-Geo] How to do cross validation for universal krigingin Gstat
Paul Hiemstra
p.hiemstra at geo.uu.nl
Mon Feb 22 09:30:49 CET 2010
Edzer Pebesma wrote:
>
>
> Kai Zhang wrote:
>> 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:
> krige only works when the secondary variable (ELE) is present both in
> the data and in the newdata argument. krige.cv only uses the data
> argument, where ELE is present.
>>
>>> 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.
>>
Hi Kai,
The krige.cv function does not need newdata because the newdata is
always equal to the data dataset. *Cross* validation means that you use
the same dataset for fitting the variogram model / regression parameters
and for validation.
Hope this makes it more clear,
cheers,
Paul
> The krige.cv documentation does not mention a newdata argument. Pls try:
>
> uk.kriged.am <- krige.cv(Temp~Ele, TMP, dtw.fit)
>
>> 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
>>>
>>>
>>
>>
>> 嗃i��'櫒ド╤∈&
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
More information about the R-sig-Geo
mailing list