Local Fitting Software

Local Fitting

Local fitting is an approach to fitting curves and surfaces to noisy data by a multivariate smoothing procedure: fitting a linear or quadratic function of the predictor variables in a moving fashion that is analogous to how a moving average is computed for a time series. Compared to classical approaches -- fitting global parametric functions -- local fitting substantially increases the domain of surfaces that can be estimated without distortion. Also, a pleasant fact about local fitting is that the methods for making inferences based on local fitting fits -- for example, ANOVA and t intervals -- are nearly the same as those used in parametric fitting.

Computational Methods for Local Fitting

Even with today's powerful computing capabilities, a straight-forward implementation of local fitting would run much too slowly. To make the use of local fitting feasible in practice, computing methods have been developed. The basic idea, quite simple, is sparse localization: carry out local fits at a judiciously chosen set of compute points in the space of the predictors, and then use interpolation to get the fitting surface elsewhere.


Software for local fitting consists of two distinct parts. The first is base software written in either C or Fortran or both, that carries out the sparse localization to produce a fit and to produce statistics for making inferences. The most widely-used base software for local fitting is available on the Web. Users with an ability to program with low-level languages like C can employ this software. In addition, many commercial statistical software packages have interface software that calls base local fitting software, substantially lightening the programming burden in carrying out local fitting.


This durable set of base routines, written in Fortran in the late 1970s, are widely used. They smooth just as a function of one predictor for data with normal errors or for data with long-tailed symmetric errors (robust fitting). Statistics for inference are not computed. S-Plus, R, Systat, XploRE, Gauss, and SAS have interfaces to LOWESS.

LOWESS base software from netlib.
SAS macro from Michael Friendly.

LOWESS was introduced in Visual and Computational Considerations in Smoothing Scatterplots by Locally Weighted Fitting. W. S. Cleveland. In Computer Science and Statistics: Eleventh Annual Symposium on the Interface, pages 96-100. Institute of Statistics, North Carolina State University, Raleigh, North Carolina, 1978. Robust Locally Weighted Fitting and Smoothing Scatterplots. W. S. Cleveland. Journal of the American Statistical Association, 74:829-836, 1979.

Computational methods were developed in LOWESS: A Program for Smoothing Scatterplots by Robust Locally Weighted Fitting. W. S. Cleveland. The American Statistician, 35:54, 1981. and implemented in the above base software.


The base software is a collection of C and Fortran subroutines that carry out local fitting for normal and long-tailed distributions and for one or more predictors. It also computes the statistics for inferences. S-PLUS has a complete implementation of LOESS as part of its modeling language.

LOESS base software from netlib.
User's manual in postscript from netlib.

LOESS was introduced in Locally-Weighted Fitting: An Approach to Fitting Analysis by Local Fitting. W. S. Cleveland and S. J. Devlin. Journal of the American Statistical Association, 83:596-610, 1988.

Computational methods were developed in Computational Methods for Local Fitting. W. S. Cleveland and E. Grosse. Statistics and Computing, 1:47-62, 1991, and implemented in the above base software.

The S-PLUS functions for LOESS are described in Statistical Models in S. W. S. Cleveland, E. Grosse, and M. Shyu, edited by J. Chambers and T. Hastie, 309-376, Chapman and Hall, 1992.


Clive Loader's marvelous base software, written in C, is by far the most ambitious. It computes fits and statistics for a wide range of distributions, including normal, long-tailed, binomial, exponential, and Poisson. It also computes density estimates. It can be used as stand-alone program with its own interface, or as a library in the S-PLUS or R systems. The code, documentation, and discussion are at

LOCFIT web site

LOCFIT (as well as the fundamentals, methods, and theory of smoothing) is described in Local Fitting and Likelihood. Clive R. Loader. Springer.


STL is a procedure, based on loess, for decomposing a seasonal time series into a seasonal and other components specified by the user. The base software is written in Fortran. S-PLUS has an interface.

STL base software from netlib.

STL was introduced in STL: A Seasonal-Trend Decomposition Procedure Based on Loess (with Discussion) . R. B. Cleveland, W. S. Cleveland, J. E. McRae, and I. Terpenning. Journal of Official Statistics, 6:3-73, 1990.