x
and
y
components that are a smooth of the
input data.
This algorithm is designed to be fast,
and by default uses cross validation to pick the span.
supsmu(x, y, wt=rep(1,length(y)), span="cv", periodic=F, bass=0)
span="cv"
, then automatic (variable) span selection is done by means
of cross validation.
TRUE
, the smoother assumes
x
is a periodic variable with values
in the range [0.0, 1.0] and period 1.0.
An error occurs if
x
has values outside this range.
bass
(up to
10
), the smoother the fit from
automatic span selection.
Values of
bass
less than
0
or greater than
10
are essentially the
same as
0
.
x
vector with duplicate points removed.
y
vector corresponding to the output
x
.
NA
s and/or
Inf
s in the input
x
,
y
or
wt
.
Such observations are dropped from the computations.
The
supsmu
function serves a purpose similar to that of the function
lowess
.
supsmu
is much faster although it does not have
the robustness properties of
lowess
.
For small samples (n<40),
or if there are substantial serial correlations between observations close
in x-value, a prespecified fixed span smoother (
span
> 0) should be used.
Reasonable span values are from
0.3
to
0.5
.
Friedman, J. H. (1984).
A Variable Span Smoother.
Tech. Rep. No. 5, Laboratory for Computational Statistics, Dept. of
Statistics, Stanford Univ., California.
The chapter "Regression and Smoothing for Continuous Response Data" in the S-PLUS Guide to Statistical and Mathematical Analysis.
plot(lottery.number, lottery.payoff, main="supsmu example") fit <- supsmu(lottery.number, lottery.payoff) lines(fit) # draw the smooth on the scatter plot resids <- lottery.payoff-approx(fit, xout=lottery.number)$y plot(lottery.number, resids) # residuals from smooth