[R-sig-Geo] Cross-validation for kriging in R (package geoR): how to include the trend while reestimate is TRUE?
v.m.vanzoest at utwente.nl
v.m.vanzoest at utwente.nl
Thu May 4 11:55:44 CEST 2017
Dear Patrick,
Thanks a lot for your quick reply and taking the time for digging deeper into the function! I will contact the package authors about the issue.
Best, Vera
---
V.M. (Vera) van Zoest, MSc | PhD candidate |
University of Twente<http://www.utwente.nl/> | Faculty ITC<http://www.itc.nl/> | Department Earth Observation Science (EOS)<https://www.itc.nl/EOS> |
ITC Building, room 2-038 | T: +31 (0)53 – 489 4412 | v.m.vanzoest at utwente.nl<mailto:v.m.vanzoest at utwente.nl> |
Study Geoinformatics: www.itc.nl/geoinformatics<http://www.itc.nl/geoinformatics>
From: Patrick Schratz [mailto:patrick.schratz at gmail.com]
Sent: maandag 1 mei 2017 20:04
To: r-sig-geo at r-project.org; Zoest, V.M. van (ITC) <v.m.vanzoest at utwente.nl>
Subject: Re: [R-sig-Geo] Cross-validation for kriging in R (package geoR): how to include the trend while reestimate is TRUE?
Hi Vera,
I started debugging a bit and the error is in line 192 of the `xvalid()` function which uses a subfunction `cv.f`
res <- as.data.frame(t(apply(matrix(locations.xvalid),
1, cv.f)))
which then does the call to `vario()` in lines 125-141.
Here, the error appears because coords (which is created in line 90) seems to be of different length then trend (which is taken from your provided variog.obj).
if (is.null(variog.obj))
stop("xvalid: when argument reestimate = TRUE an object with the fitted variogram model must be provided in the argument variog.obj ")
CVvar <- variog(coords = cv.coords, data = cv.data,
uvec = variog.obj$uvec, trend = variog.obj$trend,
lambda = variog.obj$lambda, option = variog.obj$output.type,
estimator.type = variog.obj$estimator.type,
nugget.tolerance = variog.obj$nugget.tolerance,
max.dist = max(variog.obj$u), pairs.min = 2,
bin.cloud = FALSE, direction = variog.obj$direction,
tolerance = variog.obj$tolerance, unit.angle = "radians",
messages = FALSE, ...)
CVmod <- variofit(vario = CVvar, ini.cov.pars = model$cov.pars,
cov.model = model$cov.model, fix.nugget = model$fix.nugget,
nugget = model$nugget, fix.kappa = model$fix.kappa,
kappa = model$kappa, max.dist = model$max.dist,
minimisation.function = model$minimisation.function,
weights = model$weights, messages = FALSE,
…)
Because we are debugging somewhat deep here and the issue might be quickly solved by contacting the package authors (they should get it working quickly since they provide the option ‘reestimate = TRUE'), I would try to do so first before doing any more detailed inspection of the error.
Cheers, Patrick
PhD Student at Department of Geography - GIScience group
Friedrich-Schiller-University Jena, Germany
Tel.: +49-3641-9-48973
Web: https://pat-s.github.io<https://pat-s.github.io/>
On 1. May 2017, 16:31 +0200, wrote:
http://stackoverflow.com/questions/43520716/cross-validation-for-kriging-in-r-how-to-include-the-trend-while-reestimating-t
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list