Radial Basis Function
Q: Given a numeric data set, how does one go about finding a reasonable fitting function when you have no underlying theoretical equation to work with?
A: Consider the following data set.
For this example, we know the (exact) functional form of the fitting function and could use the Statistics`NonlinearFit` package to determine the best fit. However, assume that we are just given the data set. Tony Roberts (firstname.lastname@example.org) suggests fitting with the radial basis function,
To do this, we need to solve for the coefficients in the linear equations , where is the distance between the ith and the jth data point, . We can extend the sum to include by noting that
The syntax uses Alternatives to handle both exact and approximate zeros.
In matrix form, the equations read , where . The matrix is easily constructed using Outer.
The vector can be computed efficiently using LinearSolve
Finally, the fitted function is , where is the distance from any point to the jth data point. Implementing this function as
we plot the fitted function together with the data set.
This method is robust and is simple to code. However, it can be expensive to compute if you have a lot of data points.
Copyright © 2002 Wolfram Media, Inc. All rights reserved.