https://github.com/cran/fields
Raw File
Tip revision: 8eab500c3dad2103092ff68706417414fe53e16b authored by Doug Nychka on 22 September 2009, 20:23:49 UTC
version 6.01
Tip revision: 8eab500
RadialBasis.R
RadialBasis <- function(d, M, dimension) {
    # compute the exponent for a thin-plate spline
    # based on smoothness and dimension
    p <- 2 * M - dimension
    if (p <= 0) {
        stop("M too small for thin plates spline 2m-d >0")
    }
    if (dimension%%2 == 0) {
        # factor of 2 from the log term
        ifelse(d > 1e-14, 2 * radbas.constant(M, dimension) * 
            (d^p) * log(d), 0)
    }
    else {
        radbas.constant(M, dimension) * (d^p)
    }
}
back to top