[R-sig-Geo] Summary: Fitting nested variograms to empirical variograms

Paulo Justiniano Ribeiro Jr paulojus at est.ufpr.br
Tue Oct 19 02:56:33 CEST 2004


Dear Eliot

I've been checking the geoR code and have now done a change for
lines.variomodel() be able to plot nested variograms models

You will need to update geoR from the version on its we-site
just loaded (1 min ago)
Below there is an example code on how to do that and also on how to
compute a "goodness-of- fit" measure (bearing in mind all the previous
debate on this list)

best
P.J.

require(geoR)
data(s100)
v <- variog(s100, max.dist=1)
plot(v)
## overimposing a variogram with a single structure
lines.variomodel(seq(0,1,l=101), cov.model="exp", cov.pars=c(1, .25),
nug=0)
## and accessing a "quality of fit" by sum of squares
teo1 <- cov.spatial(v$u, cov.model="exp", cov.pars=c(1, .25))
ss1 <- sum((v$v - teo1)^2)
ss1

## overimposing a variogram with two exponential structures
lines.variomodel(seq(0,1,l=101), cov.model="exp", cov.pars=rbind(c(0.6,
.15), c(0.4, .65)), nug=0, col=2)
teo2 <- cov.spatial(v$u, cov.model="exp", cov.pars=rbind(c(0.6, .15),
c(0.4, .65)))
ss2 <- sum((v$v - teo2)^2)
ss2

## overimposing a variogram with exponential and spherical structures
lines.variomodel(seq(0,1,l=101), cov.model=c("exp", "sph"),
cov.pars=rbind(c(0.6, .15), c(0.4, .65)), nug=0, col=3)
teo3 <- cov.spatial(v$u, cov.model=c("exp", "sph"), cov.pars=rbind(c(0.6,
.15), c(0.4, .65)))
ss3 <- sum((v$v - teo3)^2)
ss3


On Mon, 18 Oct 2004, Eliot McIntire wrote:

> Paulo,
>
> Sorry for one more follow-up...
>
> Your example here has a nested exponential within an exponential.  Is it
> possible to do two different models?
>
> Also, I can't see how this will help me arrive at a "quantitative" fit
> measurement, like residual sums of squares, that I can use to compare the
> fit of different models.  Am I corrent?
>
> Thank you,
> Eliot
>
> On Mon, 18 Oct 2004 14:38:17 -0200 (BRST), Paulo Justiniano Ribeiro Jr
> <paulojus at est.ufpr.br> wrote:
>
> > Eliot
> >
> > Despite of the very interesting debate and exchange of ideias on
> > validity/merit etc
> > here it is example on how to overimpose  variograms variogram models
> > using nested models in geoR.
> > It's is a try and error exercise with lines.variomodel:
> >> data(s100)
> >> v <- variog(s100, max.d=1)
> >> plot(v)
> > # a single structure variogram
> >> lines.variomodel(seq(0,1,l=100), cov.model="exp", cov.pars=c(1, .25),
> > nug=0)
> > # a nested variogram model
> >> lines.variomodel(seq(0,1,l=100), cov.model="exp", cov.pars=rbind(c(.5,
> > .1), c(.5,.3)), nug=0, col=2)
> >
> > Besides there is an tcl/tk based function with a menu and sliding bars.
> > The function is eyefit() and is based on lines.variomodel.
> > However it does not cope with nested models, but can be modifyed to do so
> >
> >
> > Best
> > P.J.
> >
> >
> >
> >
> > On Mon, 18 Oct 2004, Eliot McIntire wrote:
> >
> >> Thank you for your comments Edzer, Ole and Paulo,
> >>
> >> Edzer:
> >> > Also, be aware that the linear model with range is not a valid
> >> variogram
> >> > model for data in more than one dimension.
> >>
> >> Yes, for some reason, I copied the code for the Linear models.  I
> >> believe
> >> I had been trying nesting two exponentials or spherical and exponential,
> >> which was resulting in the error.  I tried to simplify the model by
> >> putting in the linear models and had the same problem.
> >>
> >> Ole and Edzer:
> >>
> >> > * Nested variogram models. My objection to them is based on what I
> >> have
> >> > sometimes seen : a very elaborate fitting to empirical variograms,
> >> where
> >> > a lot of effort is going into fitting the variogram away from the
> >> > origin, and where the number of variogram models used in the nested
> >> > structure seems to decided by this fitting to the empirical variogram
> >> in
> >> > mind.
> >> > A nested model for the variogram really says that the phenomenon we
> >> are
> >> > modelling is Y(x) = Y_1(x) + Y_2(x) + Y_3(x) + Y_4(x) etc. , where the
> >> > different components have different spatial structure.
> >> > Rather than letting the empirical variogram decide the number of
> >> > components, then shouldn't we start thinking about at the data
> >> > generating mechanisms instead ?
> >> > When having more than one spatial component Y_i(x), shouldn't we
> >> attempt
> >> > interpreting the different components ?
> >> > How about the implicit additivity assumption of the components when
> >> > using a nested model ? [The data generating mechanism may suggest
> >> > otherwise ... ].
> >> > A blind use of nested variogram models seems silly to me.
> >>
> >> I am an ecologist, and it is actually the mechanisms I am interested in,
> >> which is arguably more than "modeling what's out there".  The data that
> >> I
> >> am fitting using WLS fitted to empirical variograms or ML fit to the
> >> data
> >> are only just numbers.  They do, however, represent the outcome of
> >> potentially several underlying ecological mechanisms.  The context for
> >> this study is identifying competition among trees in plantations in
> >> Chile.  The expected variogram shape reflecting underlying environmental
> >> variation would be a traditional increasing function, like an
> >> exponential:
> >> closer points are more alike.  The expected variogram shape reflecting
> >> competition among trees (which is expected to be assymetrical, i.e., the
> >> larger tree negatively affects the smaller tree, the not the inverse) is
> >> more like a wave function: neighbouring trees are expected to have MORE
> >> variation than the average variation across the forest stand.  To test
> >> this mechanistic hypothesis, I have tree ring growth data from 7
> >> different
> >> forests, so I have growth increment each year for every tree.  To test
> >> for
> >> competition, I would like to fit a wave function; to test for
> >> environmental variation, I would like to fit an exponential function; to
> >> test for the two, I would like to test a nested function.  I will be
> >> comparing the relative fits of these three models using AIC (since the
> >> nested model now has more parameters, an information criterion like AIC
> >> becomes appropriate).
> >>
> >> I the end, I have decided to model my own variograms and fit them using
> >> weighted non-linear least squares, unrelated to the "built in" functions
> >> in geoR or gstat because I couldn't get them to work.  I am having
> >> success
> >> fitting the models in this way (i.e., coding my own functions).
> >>
> >> Ole:
> >> I am glad you do not bunk fitting empirical variograms, as you point
> >> out,
> >> there seems to be useful places for either approach.  And it seems to me
> >> that there are fewer distributional assumptions in fitting an empirical
> >> variogram using WLS, and that it does "a pretty good job" most of the
> >> time.
> >>
> >> I still have not had a conclusive statement that I can model nested
> >> variograms in any of these R functions.  I will write the authors.
> >>
> >> Thank you for your comments,
> >> Eliot
> >>
> >>
> >> On Sat, 16 Oct 2004 10:49:17 +0200, Edzer J. Pebesma
> >> <e.pebesma at geog.uu.nl> wrote:
> >>
> >> >
> >> >
> >> > Eliot McIntire wrote:
> >> >
> >> >>
> >> >> gstat: I can run nested models using
> >> >> F2.BA1.fit = fit.variogram (F2.BA1.variogram, vgm(psill=33,"Lin",6,
> >> >> add.to  = vgm(psill=33,"Lin",6, nugget=20) )
> >> >>                 , print.SSE=T, fit.sills=T, fit.ranges=T )
> >> >>
> >> >>
> >> >> but I never seem to get a good fit, i.e., it always fails to fit the
> >> >> empirical variogram.
> >> >>
> >> >> If anyone has a solution, I also need to calculate the Residual Sums
> >> >> of  Squares to test for the relative fit.
> >> >
> >> > The problem is your starting values for the ranges. Use the values
> >> that
> >> > you
> >> > fit `by eye' from the sample variogram; they should be sufficiently
> >> > distinct
> >> > (and present in the sample variogram) for gstat to fit them with
> >> success.
> >> >
> >> >
> >> > Best regards,
> >> > --
> >> > Edzer
> >>
> >>
> >>
> >> --
> >> Eliot McIntire
> >> NSERC Post Doctoral Fellow
> >> Department of Ecosystems and Conservation Science
> >> College of Forestry and Conservation
> >> University of Montana, Missoula, MT 59812
> >> 406-243-5239
> >> fax: 406-243-4557
> >> emcintire at forestry.umt.edu
> >>
> >> _______________________________________________
> >> R-sig-Geo mailing list
> >> R-sig-Geo at stat.math.ethz.ch
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>
> >>
> >
> > Paulo Justiniano Ribeiro Jr
> > Departamento de Estatística
> > Universidade Federal do Paraná
> > Caixa Postal 19.081
> > CEP 81.531-990
> > Curitiba, PR  -  Brasil
> > Tel: (+55) 41 361 3573
> > Fax: (+55) 41 361 3141
> > e-mail: paulojus at est.ufpr.br
> > http://www.est.ufpr.br/~paulojus
> >
> >  /"\
> >  \ /  Campanha da fita ASCII - contra mail html
> >   X   ASCII ribbon campaign - against html mail
> >  / \
> >
>
>
>
> --
> Eliot McIntire
> NSERC Post Doctoral Fellow
> Department of Ecosystems and Conservation Science
> College of Forestry and Conservation
> University of Montana, Missoula, MT 59812
> 406-243-5239
> fax: 406-243-4557
> emcintire at forestry.umt.edu
>
>

Paulo Justiniano Ribeiro Jr
Departamento de Estatística
Universidade Federal do Paraná
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 361 3573
Fax: (+55) 41 361 3141
e-mail: paulojus at est.ufpr.br
http://www.est.ufpr.br/~paulojus

 /"\
 \ /  Campanha da fita ASCII - contra mail html
  X   ASCII ribbon campaign - against html mail
 / \




More information about the R-sig-Geo mailing list