Ford, C.; Etter, D.M., "Wavelet basis reconstruction of nonuniformly sampled data," in Circuits and Systems II: Analog and Digital Signal Processing, IEEE Transactions on , vol.45, no.8, pp.1165-1168, Aug 1998
The discrete Fourier transform (DFT) may be derived from linear regression, where a complete set of N complex sinusoids are the basis functions to be fitted to N points, using
b = inv(X'*X)*X'*Y, (1)
where Y is a column vector of length N containing the sampled signal; X is an NxN matrix, containing the basis functions along its columns, evaluated at the sample times; and b is your complex spectrum - a column vector of length N .
For a uniform sampling rate and a uniform error-weighting function, the basis set is orthonormal, so X'*X = I (the identity matrix). This tends to hide this fundamental fact. In this case, we simply get
b = X'*Y. (2)
So for uniform sampling and a uniform error weight, we use (2), perhaps without realizing that we are actually doing linear regression.
For non uniform sampling (and a uniform weight), you will need to use (1), because the basis set will not be orthogonal.