[R-sig-Geo] variograms do not satisfy a legal model
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Mon May 7 16:49:23 CEST 2007
Dear useRs,
I'm trying to do some cokriging. I try fit the variograms with fit.lmc
(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, "Sph", 900, .05),
fit.ranges = FALSE)
g <- gstat(g, id = "ln.zinc", model = model[["model"]][["ln.zinc"]])
g <- gstat(g, id = "ln.lead", model = 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 ranges. Or am I
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, .05))
g <- 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 for Nature
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 carefully
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
More information about the R-sig-Geo
mailing list