Error fitting separable space-time variogram model
The error occurs when the internally used optim function tries a non-positive range. You can either try to use different start values for your model or provide boundary arguments as in optim to fit.StVariogram. These are passed on to optim via ..., see the help page of optim for details. The demo stkrige provides as well examples on how to limit the range of possible parameter values. Hth, Ben
On March 8, 2014 10:15:55 AM CET, d.g.rossiter at utwente.nl wrote:
I am developing a tutorial on space-time geostatistics, expanding on the nice st.pdf vignette. I can successfully fit a metric variogram model to an s-t empirical variogram, but when I try to fit a separable model I get an error which I can't solve nor interpret: "Error in vgm(1 - par[4], as.character(model$time$model[2]), par[3], par[4], : range should be positive" A reproducible example follows. I updated all packages immediately before running this example. Thanks for your help. System info:
version
platform x86_64-apple-darwin10.8.0 arch x86_64 os darwin10.8.0 system x86_64, darwin10.8.0 status major 3 minor 0.2 year 2013 month 09 day 25 svn rev 63987 language R version.string R version 3.0.2 (2013-09-25) nickname Frisbee Sailing
help(package="sp")$info[[1]][2]
[1] "Version: 1.0-14"
help(package="spacetime")$info[[1]][2]
[1] "Version: 1.0-9"
help(package="xts")$info[[1]][4]
[1] "Version: 0.9-7"
help(package="gstat")$info[[1]][2]
[1] "Version: 1.0-18"
## condensed and adapted from st.pdf, 13-Feb-2013
require(sp); require(xts); require(spacetime); require(gstat)
## Germany & neighbours air quality
data(air)
rr <- rural[, "2005::2010"]
na.stations <- which(apply(as(rr, "xts"), 2, function(x)
all(is.na(x))))
r5to10 <- rr[-na.stations,]
vst <- variogram(PM10 ~ 1, r5to10[,1:200])
plot(vst, map=FALSE)
## code from p. 8 of st.pdf
vgm.sep <- vgmST(stModel="separable",
space=vgm(0.9,"Exp", 123,0.1),
time=vgm(0.9,"Exp", 2.9, 0.1),
sill=60)
vgmf.sep <- fit.StVariogram(vst, vgm.sep, method = "L-BFGS-B") ## gives
an error
## "Error in vgm(1 - par[4], as.character(model$time$model[2]), par[3],
par[4], :
## range should be positive"
## my system and package info
version
help(package="sp")$info[[1]][2]
help(package="spacetime")$info[[1]][2]
help(package="xts")$info[[1]][4]
help(package="gstat")$info[[1]][2]
------------------------------------------------------------------------
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Benedikt Gr?ler Institute for Geoinformatics University of M?nster http://www.ifgi.de/graeler +49 251 83 33082