-----Oorspronkelijk bericht-----
Van: Edzer J. Pebesma [mailto:e.pebesma at geo.uu.nl]
Verzonden: maandag 7 mei 2007 17:00
Aan: ONKELINX, Thierry
CC: r-sig-geo at stat.math.ethz.ch
Onderwerp: Re: [R-sig-Geo] variograms do not satisfy a legal model
Thierry, you'll have to find out what the linear model of
regionalization or intrinsic correlation mean; they are legal
models, meaning that they lead to predictions with guaranteed
non-negative prediction variances. There's a way to override
the check (meaning it will not stop on error) but not to get
that guarantee.
--
Edzer
ONKELINX, Thierry wrote:
Dear useRs,
I'm trying to do some cokriging. I try fit the variograms
(gstat package).
#Problem 1: how to get the model in an elegant way into the gstat
object? This is how I do it now.
library("gstat")
data(meuse)
g <- gstat(id = "ln.zinc", formula = log(zinc)~1, locations = ~x+y,
data = meuse) g <- gstat(g, id = "ln.lead", formula = log(lead)~1,
locations = ~x+y, data = meuse) #fit the variogram models using
fit.lmc model <- fit.lmc(variogram(g), g, model = vgm(.55,
.05), fit.ranges = FALSE) g <- gstat(g, id = "ln.zinc", model =
model[["model"]][["ln.zinc"]]) g <- gstat(g, id =
model[["model"]][["ln.lead"]]) g <- gstat(g, id = c("ln.zinc",
"ln.lead"), model =
model[["model"]][["ln.zinc.ln.lead"]])
predict(g, newdata = meuse)
#Problem 2. the gstat object doesn't accept different
doing something wrong?
library("gstat")
data(meuse)
g <- gstat(id = "ln.zinc", formula = log(zinc)~1, locations = ~x+y,
data = meuse) g <- gstat(g, id = "ln.lead", formula = log(lead)~1,
locations = ~x+y, data = meuse) # examine variograms and cross
variogram:
plot(variogram(g))
# enter direct variograms:
g <- gstat(g, id = "ln.zinc", model = vgm(.55, "Sph", 800,
gstat(g, id = "ln.lead", model = vgm(.55, "Sph", 900, .05)) # enter
cross variogram:
g <- gstat(g, id = c("ln.zinc", "ln.lead"), model = vgm(.47, "Sph",
900,
.03))
predict(g, newdata = meuse)
# Error in predict.gstat(g, newdata = meuse) : gstat: value not
allowed
for: variograms do not satisfy a legal model
Thanks,
Thierry
----------------------------------------------------------------------
--
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Reseach Institute
and Forest Cel biometrie, methodologie en kwaliteitszorg / Section
biometrics, methodology and quality assurance Gaverstraat 4 9500
Geraardsbergen Belgium tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have
considered what they do not say. ~William W. Watt A statistical
analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney