Fitting models to data
A large part of scientific computation involves using data to determine the parameters in theoretical or empirical model equations. Not surprisingly, given its statistical roots, R has powerful tools for fitting functions to data. In this chapter we discuss the most important of these tools: linear and nonlinear least-squares fitting, and polynomial and spline interpolation. We also show how these methods can be used to accelerate the convergence of slowly convergent series with Padé and Shanks approximations. We then consider the related topics of time series, Fourier analysis of periodic data, spectrum analysis, and signal processing, with a focus on extracting signal from noise.