\Header{supsmu}{Friedmans's SuperSmoother}
\keyword{smooth}{supsmu}
\begin{Usage}
\begin{verbatim}
supsmu(x, y, wt=rep(1, length(y)), span="cv", periodic=FALSE, bass=0)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x}] x values for smoothing
\item[\texttt{y}] y values for smoothing
\item[\texttt{wt}] case weights
\item[\texttt{span}] the fraction of the observations in the span of the running
lines smoother, or \texttt{"cv"} to choose this by leave-one-out
cross-validation.
\item[\texttt{periodic}] If true, the x values are assumed to be in \texttt{[0,
     1]} and of period 1.
\item[\texttt{bass}] controls the smoothness of the fitted curve. Values of up
to 10 indicating increasing smoothness.
\end{ldescription}
\end{Arguments}
\begin{Description}
Smooth the (x, y) values by Friedman's "super smoother".\end{Description}
\begin{Details}
\texttt{supsmu} is a running lines smoother which chooses between three
spans for the lines. The running lines smoothers are symmetric, with
\texttt{k/2} data points each side of the predicted point, and values of
\texttt{k} as 0.5n, 0.2n and 0.05n. If \texttt{span} is specified, as
single smoother with span \texttt{span} * n is used.

The best of the three smoothers is chosen by cross-validation for each
prediction. The best spans are then smoothed by a running lines
smoother and the final prediction chosen by linear interpolation. 

The Fortran code says: "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."\end{Details}
\begin{Value}
A list with components
\begin{ldescription}
\item[\texttt{x}] the input values in increasing order with duplicates removed.
\item[\texttt{y}] the corresponding y values on the fitted curve.
\end{ldescription}
\end{Value}
\begin{Author}
B.D. Ripley\end{Author}
\begin{References}
Friedman, J. H. (1984)
SMART User's Guide.
Laboratory for Computational Statistics, Stanford University Technical
Report No. 1.

Friedman, J. H. (1984)
A variable span scatterplot smoother.
Laboratory for Computational Statistics, Stanford University Technical
Report No. 5.\end{References}
\begin{SeeAlso}
\texttt{\Link{ppr}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(cars)
attach(cars)
plot(speed, dist)
lines(supsmu(speed, dist))
lines(supsmu(speed, dist, bass=7), lty=2)
detach()
\end{ExampleCode}
\end{Examples}

