https://github.com/cran/fields
Tip revision: 8eab500c3dad2103092ff68706417414fe53e16b authored by Doug Nychka on 22 September 2009, 20:23:49 UTC
version 6.01
version 6.01
Tip revision: 8eab500
Krig.transform.xY.R
# fields, Tools for spatial data
# Copyright 2004-2007, Institute for Mathematics Applied Geosciences
# University Corporation for Atmospheric Research
# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
Krig.transform.xY <- function(obj, knots, verbose = FALSE) {
# find all replcates and collapse to unique locations and mean response
# and pooled variances and weights.
out <- Krig.replicates(obj, verbose = verbose)
if (verbose) {
cat("yM from Krig.transform.xY", fill = TRUE)
print(out$yM)
}
#
# save information about knots.
if (is.na(knots[1])) {
out$knots <- out$xM
out$mle.calc <- TRUE
out$knot.model <- FALSE
}
else {
out$mle.calc <- FALSE
out$knot.model <- TRUE
out$knots <- knots
}
#
# scale x, knot locations and save transformation info
#
out$xM <- transformx(out$xM, obj$scale.type, obj$x.center,
obj$x.scale)
out$transform <- attributes(out$xM)
out$knots <- scale(out$knots, center = out$transform$x.center,
scale = out$transform$x.scale)
#
#
#verbose block
#
if (verbose) {
cat("transform", fill = TRUE)
print(out$transform)
}
if (verbose) {
cat("knots in transformed scale", fill = TRUE)
print(knots)
}
return(out)
}