We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addAttrToGeom doesn't change the newdata. I think it should be newdata = addAttrToGeom(newdata, as.data.frame(sims)) krigeSimCE = function (formula, data, newdata, model, n = 1, ext = 2) { stopifnot(is(model, "variogramModel")) stopifnot(gridded(newdata)) if (!missing(data)) stopifnot(identical(data@proj4string@projargs, newdata@proj4string@projargs)) varName <- all.vars(formula[[2]]) condSim <- TRUE if (missing(data)) { condSim <- FALSE message("[No data provided: performing unconditional simulation.]") } else { message("[Performing conditional simulation.]") } covMat <- ceWrapOnTorusCalcCovRow1(newdata, model, ext = ext) sims <- ceSim(covMat, n, newdata@[email protected], [email protected]) colnames(sims) <- paste0(varName, ".sim", 1:n) if (!condSim) { if ("data" %in% slotNames(newdata)) newdata@data <- cbind(newdata@data, sims) else newdata = addAttrToGeom(newdata, as.data.frame(sims)) return(newdata) } obsMeanField <- krige(formula, data, newdata, model) simMeanObsLoc <- krigeMultiple(as.formula(paste0("var1.pred ", formula[[3]])), obsMeanField, data, model, sims) simMeanFields <- krigeMultiple(as.formula(paste0(varName, "", formula[[3]])), data, newdata, model, simMeanObsLoc) sims <- obsMeanField@data$var1.pred + sims - simMeanFields if ("data" %in% slotNames(newdata)) { newdata@data <- cbind(newdata@data, sims) return(newdata) } newdata = addAttrToGeom(newdata, as.data.frame(sims)) }
The text was updated successfully, but these errors were encountered:
@BenGraeler ?
Sorry, something went wrong.
I mean the "newdata = " part is missing in the original code.
No branches or pull requests
addAttrToGeom doesn't change the newdata. I think it should be newdata = addAttrToGeom(newdata, as.data.frame(sims))
krigeSimCE = function (formula, data, newdata, model, n = 1, ext = 2)
{
stopifnot(is(model, "variogramModel"))
stopifnot(gridded(newdata))
if (!missing(data))
stopifnot(identical(data@proj4string@projargs, newdata@proj4string@projargs))
varName <- all.vars(formula[[2]])
condSim <- TRUE
if (missing(data)) {
condSim <- FALSE
message("[No data provided: performing unconditional simulation.]")
}
else {
message("[Performing conditional simulation.]")
}
covMat <- ceWrapOnTorusCalcCovRow1(newdata, model, ext = ext)
sims <- ceSim(covMat, n, newdata@[email protected], [email protected])
colnames(sims) <- paste0(varName, ".sim", 1:n)
if (!condSim) {
if ("data" %in% slotNames(newdata))
newdata@data <- cbind(newdata@data, sims)
else newdata = addAttrToGeom(newdata, as.data.frame(sims))
return(newdata)
}
obsMeanField <- krige(formula, data, newdata, model)
simMeanObsLoc <- krigeMultiple(as.formula(paste0("var1.pred
",", formula[[3]])), data, newdata, model, simMeanObsLoc)formula[[3]])), obsMeanField, data, model, sims)
simMeanFields <- krigeMultiple(as.formula(paste0(varName,
"
sims <- obsMeanField@data$var1.pred + sims - simMeanFields
if ("data" %in% slotNames(newdata)) {
newdata@data <- cbind(newdata@data, sims)
return(newdata)
}
newdata = addAttrToGeom(newdata, as.data.frame(sims))
}
The text was updated successfully, but these errors were encountered: