[R-sig-Geo] fit variogram base on cross validation

Tom Gottfried tom.gottfried at tum.de
Mon Jan 2 15:49:33 CET 2012


See ?gstat and especially what is said about the argument 'model' to see how to specify a 
semivariogram model.
In your first example you would do

gstat(NULL, "d", d~1, dd, model=vgm(1540.996, "Sph", 60843.42, 0.21))

regards,

Tom

Am 02.01.2012 15:20, schrieb Saman Monfared:
> Dear All
> I want fit a variogram or cross variogram but not based on
> (fit.variogram for direct variogram)
> or (fit.lmc
> for cross variogram). I think these programs fit variogram based on
> minimum SSerr Whereas there is
> any guarante that model with minimum SSerr be the best
> model.Geostatistics meno in ArcGis10 provide
>   a program that it optimize  variogram or cross variogram based on
> leave one out cross validation then
> the optimized model has the best cross validation in each kriging method.
>
> Is there any program in R that fit variogram or cross variogram based
> on cross validation???
>
> For example I want fit a variogram model based on Empirical variogram:
>
> vv<-variogram(d~1, data=dd)
> fit.variogram(vv, vgm(0,"Sph",23000,1)
> R output:
>
>    model    psill    range
> 1   Nug    0.000     0.00
> 2   Sph 1970.996 80843.42
>
> But I know for example that optimum model based on cross validation is:
>
>   model    psill    range
> 1   Nug    .21     0.00
> 2   Sph 1540.996 60843.42
>
> How can I use this model in gstat or other packages??
>
> How do I extend it to cross variogram??
>
> for cross variogram :
>
> m<-vgm(0,"Lin",23000,1)
> g<- gstat(NULL, id = " B", form =  TB ~ 1,data=dd,fill.cross = F)
> g<- gstat(g, id = "E", form = TE~ 1,data=dd,fill.cross = F)
> g<- gstat(g, id = "T", form =  T~ 1,data=dd,fill.cross = F)
> vm<- variogram(g)
> vm.fit<- fit.lmc(vm, g, model=m)
> R output:
>
> variograms:
>          model        psill range
>   B[1]     Nug   0.07360566     0
>   B[2]     Lin   0.25714578 60017
> E[1]      Nug   2.46512449     0
> E[2]      Lin 108.96281576 60017
> T[1]      Nug   2.41847897     0
> T[2]      Lin  13.22390243 60017
>   B.E[1]   Nug  -0.26696750     0
>   B.E[2]   Lin   3.26071039 60017
>   B.T[1]   Nug  -0.25868233     0
>   B.T[2]   Lin  -1.00004909 60017
> E.T[1]    Nug   2.21925267     0
> E.T[2]    Lin -33.10121223 60017
>
> Whereas I know the best cross variogram based on optimized cross validation is:
>
> variograms:
>          model        psill range
>   B[1]     Nug   0.04660566     0
>   B[2]     Lin   0.34714578 75017
> E[1]      Nug   2.54512449     0
> E[2]      Lin 123.96281576 75017
> T[1]      Nug   4.41847897     0
> T[2]      Lin  12.22390243 75017
>   B.E[1]   Nug  -1.26696750     0
>   B.E[2]   Lin   1.26071039 75017
>   B.T[1]   Nug  -1.25868233     0
>   B.T[2]   Lin  -2.00004909 75017
> E.T[1]    Nug   2.21925267     0
> E.T[2]    Lin -23.10121223 75017
>
> What can I do to use a arbitrary variogram model??
>

-- 
Technische Universität München
Department für Pflanzenwissenschaften
Lehrstuhl für Grünlandlehre
Alte Akademie 12
85350 Freising / Germany
Phone: ++49 (0)8161 715324
Fax:   ++49 (0)8161 713243
email: tom.gottfried at wzw.tum.de
http://www.wzw.tum.de/gruenland



More information about the R-sig-Geo mailing list