[R-sig-Geo] gstat: Cokriging with unusual neighbourhood choice - is this possible?
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Mon Aug 12 16:11:28 CEST 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/31/2013 02:26 PM, Ralph Mettier wrote:
> Dear Edzer
>
> Thank you greatly for your reply. I have attempted to implement
> the solution you suggested, but either it's not what I was looking
> for, or more likely, I'm missing something. Currently the relevant
> code passage looks like this:
>
> ##--------------------
>
> m.grid=data.frame(x=outgrid$V1,y=outgrid$V2)
> m_preca=data.frame(x=prec[,2],y=prec[,3],preca=prec[,5])
> m_precb=data.frame(x=conc[,2],y=conc[,3],precb=conc[,6])
> m_conc=data.frame(x=conc[,2],y=conc[,3],conc=conc[,5])
> coordinates(m.grid) = ~x+y coordinates(m_preca)=~x+y
> coordinates(m_precb)=~x+y coordinates(m_conc)=~x+y
>
> ## Gstat m.g=gstat(id="conc",formula=conc ~ 1, data = m_conc,
> nmax=16,model=vgm(0.4,"Pow",1,add.to=vgm(120,"Sph",200,10)))
> m.g=gstat(m.g,id="preca",formula=preca ~ 1,
> data=m_preca,nmax=16,model=vgm(0.1,"Pow",1,add.to=vgm(25,"Sph",200,80)))
>
>
m.g=gstat(m.g,id="precb",formula=precb ~ 1,
> data=m_precb,nmax=16,model=vgm(0.1,"Pow",1,add.to
> =vgm(25,"Sph",200,80)),merge=list(c("preca",1,"precb",1)))
> m.g=gstat(m.g,id=c("conc","preca"),model=vgm(0.01,"Pow",1,add.to
> =vgm(110,"Sph",200,70)))
> m.g=gstat(m.g,id=c("preca","precb"),model=vgm(0.01,"Pow",1,add.to
> =vgm(110,"Sph",200,70)))
> m.g=gstat(m.g,id=c("conc","precb"),model=vgm(0.01,"Pow",1,add.to
> =vgm(110,"Sph",200,70)))
>
> ## Empirical Variogram
> m.g.var=variogram(m.g,width=110,cutoff=600,pseudo=-1) ## Fitting
> m.g.fit=fit.lmc(m.g.var,m.g,fit.lmc=TRUE,fit.ranges=FALSE,correct.diagonal=1.01,fit.method=7)
>
> ## Force same variograms for preca and precb
> m.g.fit$model$preca=m.g.fit$model$preca.precb
> m.g.fit$model$precb=m.g.fit$model$preca.precb
>
> ## Co-Kriging m.g.fit$set=list(nocheck=1)
> m.g.pred=predict(m.g.fit,newdata=m.grid)
>
> ##----------------------------
>
> As you can see from the variable names, this has organically grown
> from something inspired by the 'meuse' example in gstat. Here's
> what I think I'm doing:
>
> - set up a three variable gstat object, where two variables (conc
> and precb) come from the same measuring stations. preca comes from
> another station network, as discribed in my first message. - fit
> variograms and cross-variograms to this object - force the
> variograms for 'preca' and 'precb' and their cross-variogram to be
> identical - use the variograms for co-kriging
>
> Am I making some fundamental mistake?
If you do, I can't see it, but then you were not very explicit about
what you expect, nor about what you got by doing this.
Cokriging makes shure both variables get a different mean effect
fitted. But if they are different variables, why would they have the
same variogram? Having a cross variogram that equals both direct
variogram (or the square root of their product) implies perfect
correlation: this does not correspond to what you called "a decent
correlation" in your earlier email.
>
> Best Regards Ralph
>
> [[alternative HTML version deleted]]
>
> _______________________________________________ R-sig-Geo mailing
> list R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
- --
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSCO0QAAoJEM1OCHCtOnfx/fMH/0CcRm/hHVTtC1tV31E5YpqP
uob74Q2oKr7jReu507rzl2DgfMe6BVSCt0CrHANWT0lE6DkhVxTsWZCwvQwiESCI
A7F6n2vKKlRMGGu7cO3CzjTP3lk80RWNMMRcl6F0vimA8DsaOrcThfo6VKvSWsIf
NGJ4LTKlJq51NAehKFPok6HJ6j6/6eJxI8r3Dej3QbyXxG0cX9abOsdQ1SW5Xtkk
3zDOXHgm33pyewzfbpALG3fIJnlUoa6xh0SIvwu9NmZcpTd/ChC+DTPC5e/zGgoZ
GjZrTXxnWjndMYTWEawv9Ib8jqzD0ncOs5w2QT+Rs/Dg3evk/W9X9rExp1X3pPc=
=dQI3
-----END PGP SIGNATURE-----
More information about the R-sig-Geo
mailing list