A method and apparatus for compensating waveforms, spectra, and profiles derived therefrom for effects of drift is disclosed. The present invention removes the effects of drift from a sequential series of waveforms obtained from a waveform-source device, or spectra, from a
spectrometer, to produce for output a sequential series of drift-compensated waveforms, or spectra, respectively. In addition, the present invention performs a
factor analysis, or alternatively a linear-least-squares analysis, on an array of the drift-compensated waveforms, or spectra to provide a set of drift-compensated principal factors; and, generates drift-compensated scaled target-factor profiles from a profile trajectory
lying within a space of the set of drift-compensated principal factors. In addition, in the case of spectra, the invention provides for conversion of the drift-compensated scaled target-factor profiles to drift-compensated compositional profiles. The invention finds particular utility in the field of
electron spectroscopy when the invention is applied to correcting sputter-depth-profile analyzes for the effects of spectral drift caused by charging in insulating samples. The invention, by extension, also, finds utility in waveform
processing in situations where a sequential series of waveforms having similar features are offset by arbitrary phase shifts, and, even more generally, in time-series analysis, where a time-series is affected by leading or lagging data.