loess(vx, vy, span) or loess(Mx,
vy, span) Returns a vector which interp uses to find a set
of second-order polynomials that best fit
the neighborhood of x and y
data values in vx and vy in the least-squares
sense. The size of the neighborhood is controlled by span.
Can also be used for multivariate regression, where a matrix Mxy
of k independent variables and a vector of dependent
values, vy, are used to fit second-order polynomial
surfaces in k dimensions.
interp(vs, vx, vy, x) or interp(vs,
Mx, vy, X) Returns the interpolated y-value
corresponding to x using the output vector vs from loess. If loess has been used to
fit a multidimensional surface, X is a vector of independent
variables at which to calculate the interpolated y-value.
Arguments:
vx and vy
are vectors of real data values and are of the same length.
Mx is a matrix of
real data values. There is one column for each independent variable (k ≤ 4 columns). In this case, vy
has the same number of rows as Mx.
vs is a vector generated
by loess.
span is a positive real
number specifying the size of the data neighborhood. Use larger values
of span when the data behaves very differently
over different ranges of x. A good default value
is span = 0.75.
x is the value of the independent
variable at which you want to evaluate the regression curve.
X is the vector
of values of the independent variables at which you want to evaluate the
regression surface.
Notes:
The loess function tries to fit different
second order polynomials depending on where you are on the curve. It does
this by examining the data in a small neighborhood of the point you are
interested in. The span argument controls the
size of this neighborhood. As span gets larger,
loess becomes equivalent to regress
with n = 2.
To fit a single polynomial to your data, use regress.