polyh: Polyharmonic splines on scattered data

Description Usage Arguments Details Value Examples

View source: R/polyharmonic.R

Description

Polyharmonic splines on scattered data.

Usage

1

Arguments

...

Further arguments to the function, if is.function(val).

val

array or function. Function values on scattered data, or the function itself.

knots

matrix. Each column is a point in an M-dimensional space.

k

positive integer or negative numeric. The degree of the polyharmonic spline.

normalize

logical, vector or matrix. Should coordinates be normalized?

nowarn

logical. Avoid warning about fallback to least squares fit.

Details

polyh fits a polyharmonic spline with radial basis function x^k for odd k, and x^k log(x) for even k. If k < 0, the basis exp(k x^2) is used. There are more details in a vignette.

If val is a function it will be evaluated on the knots.

normalize can be used to change the scaling on the space. Set normalize=TRUE to do an affine transformation on the knots into the unit hybercube. The default is to transform if any of the knot-coordinates are outside the interval [0,1]. You may also specify normalize as an M x 2 matrix, where the columns a and b are used for the normalization: x -> a*(x-b). normalize can be set to a vector of length 2 c(a, b) if the same normalization should apply in each dimension. Set normalize=FALSE if you do not want any scaling.

Value

A function(x) defined on the multidimensional space, approximating the given function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# a function on a 20-dimensional space
r <- runif(20)
r <- r/sum(r)
f <- function(x) 1/mean(log1p(r*x))
# 1000 random knots 
knots <- matrix(runif(20000), 20)
phs <- polyh(f, knots, 3)
# test it in a random point
s <- runif(20)
c(true=f(s), phs(s))

## End(Not run)

Example output

Warning message:
'polyh' is deprecated.
Use 'ipol' instead.
See help("Deprecated") and help("chebpol-deprecated"). 
    true          
34.42903 33.90341 

chebpol documentation built on Dec. 9, 2019, 5:08 p.m.