[R] How to make Ordinary Kriging using gstat predict?
Jon Olav Skoien
jon.skoien at jrc.ec.europa.eu
Wed Dec 19 16:30:22 CET 2012
Hi Dimitris,
The mistake is that predict.gstat doesnt have a "model" argument, as you
assume. But as the function also accepts arguments through ..., it does
not complain about the unused argument.
Try instead to put the model argument in the gstat-object as you can see
in the example in ?predict.gstat:
g <- gstat(id="tec", formula=TEC ~ 1, data=data, model = v.fit)
Cheers,
Jon
BTW, you will generally get quicker response to questions regarding any
kind of spatial data handling from the mailinglist r-sig-geo at r-project.org.
On 17-Dec-12 18:58, DIMITRIS KARAKOSTIS wrote:
>
> Thanks for the answer. I have already read the gstat manual and I had constructed the empirical and theoretical variogram like this:
> g <- gstat(id="tec", formula=TEC ~ 1, data=data)v <- variogram(g)mod<-vgm(sill=var(data$TEC),model="Sph",range=200,nugget=10)v.fit <- fit.variogram(v, model=mod,fit.method=1)Theor_variogram=plot(variogram(TEC~1,data),v.fit,main="WLS Model")plot(Theor_variogram)
>
> But still, when I use predict:p <- predict.gstat(g, model=v.fit, newdata=predGrid)
> ..instead of ordinary kriging I get inverse distance weighted.Please, if anyone knows where I make the mistake or what I miss, please let me know!Thanks
>
>
>
>
>> From: S.Ellison at LGCGroup.com
>> To: dimitriskarakostis3 at hotmail.com; r-help at r-project.org
>> Date: Mon, 17 Dec 2012 17:22:12 +0000
>> Subject: RE: [R] How to make Ordinary Kriging using gstat predict?
>>
>>
>>> -----Original Message-----
>>> My problem is that instead of Ordinary kriging, when I run
>>> the algorithm I get: Inverse distance weighted interpolation.
>>> Why is that? What am I missing or doing wrong?
>> The gstat manual at http://www.gstat.org/gstat.pdf says on p16 that "When no variograms are specified, inverse distance weighted interpolation
>> is the default action (Fig. 2.1, example [6.3]).
>> When variograms are specified the default prediction method is ordinary
>> kriging Journel and Huijbregts (1978); Cressie (1993) (example [6.4] and
>> example [6.8])."
>>
>> It looks like reading that manual may be useful ...
>>
>> S Ellison
>>
>> *******************************************************************
>> This email and any attachments are confidential. Any u...{{dropped:11}}
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Land Resource Management Unit
Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.
More information about the R-help
mailing list