dono 发表于 2013-11-24 09:49:54

超级平滑

supsmu: Smoothing of scatterplots using Friedman's supersmoother algorithm.

Syntax:
    Y_SMOOTH = supsmu(X,Y,'PropertyName',PropertyValue,...)

Inputs:
    X, Y are same-length vectors.

Output
    Y_SMOOTH is a smoothed version of Y.

Example,
    x = linspace(0,1,201);
    y = sin(2.5*x) + 0.05*randn(1,201);
    smo = supsmu(x,y);
    plot(x,y,'o',x,smo)

The supersmoother algorithm computes three separate smooth curves from
the input data with symmetric spans of 0.05*n, 0.2*n and 0.5*n, where n
is the number of data points.The best of the three smooth curves is
chosen for each predicted point using leave-one-out cross validation. The
best spans are then smoothed by a fixed-span smoother (span = 0.2*n) and
the prediction is computed by linearly interpolating between the three
smooth curves.This final smooth curve is then smmothed again with a
fixed-span smoother (span = 0.05*n).

According to comments by Friedman, "For small samples (n < 40) or if
there are substantial serial correlations between observations close in
x-value, then a prespecified fixed span smoother (span > 0) should be
used.Reasonable span values are 0.2 to 0.4."


The following optional property/value pairs can be specified as arguments
to control the indicated behavior:

    Property    Value
    --------------------------------------------------------------------
    Weights   Vector of relative weights of each data point.Default is
                for all points to be weighted equally.

    Span      Sets the width of a fixed-width smoothing operation
                relative to the number of data points, 0 < SPAN < 1.
                Setting this to be non-zero disables the supersmoother
                algorithm.Default is 0 (use supersmoother).

    Period      Sets the period of periodic data.Default is Inf
                (infinity) which implies that the data is not periodic.
                Can also be set to zero for the same effect.

    Alpha       Sets a small-span penalty to produce a greater smoothing
                effect.0 < Alpha < 10, where 0 does nothing and 10
                produces the maximum effect.Default = 0.

    Unsorted    If the data points are not already sorted in order of the X
                values then setting this to true will sort them for you.
                Default = false.

All properties names are case-insensitive and need only be unambiguous.
For example,

    Y_SMOOTH = supsmu(X,Y,'weights',ones(n,1),'per',2*pi)

is valid usage.


页: [1]
查看完整版本: 超级平滑