Robust outlier detection in curve fitting with correlated errors Assume I have data originating from a model
$$
y_i=f(t_i)+e(t_i)
$$
with $f\in C_2(\mathbb{R})$. 
The only thing I know about the errors is that they roughly happen to be of to different sources:


*

*Some more or less random noise of varying magnitude over time. The noise might just oscillate between different values or may look rather random

*Massive outliers. Those usually are correlated over a few time steps, mostly even lying on a straight line (e.g. $e(t_i)=at_i+b$ for $i=k,k+1,k+2$). In the presence of outliers, the noise usually can be ignored or is even non-existant.


As long as there are no outliers involved, I am quite successful fitting B-Splines through the data. However, this approach fails if the outliers have not been removed. 
All fitting has to be done highly automated, thus manual analysis is no option. 
One Idea I have for detecting the outliers is to estimate a local measure of dispersion and declare all datapoints as outliers that are much further away form a local estimate on position than that measure. 
To identify my estimate on position, I have been very successful using a local median as robust estimate. A straightforward extension would be to use a local MAD as measure for dispersion.
However, now my theoretical knowledge is stretched to its limits. I do not really have the background to understand what I am doing from an analytical and mathematical point of view. 
Thus, my question is twofold:


*

*Do you have a better idea on how to identify outliers? (Just drop me a thought, I will gladly do the research)

*Can you recommend literature giving me theoretical background on rubust dispresion estimation? Even better for models like the one I have sketched.


P.S.: While I had quite a few lectures on statistics at university, my background is based on numerical analysis, so please be gentle. 
 A: In order to identify outliers, one needs to have an equation that adequately describes the signal. When faced with analyzing time series data fitting splines initially seems interesting but ultimately fails. The problem is that one has to determine the number of splines ( pure deterministic structure) and the length of each spline.This approach essentially is a fitting approach rather than a modelling (data-based) approach. The nature of the signal and the nature of the errors needs to be identified. Possible models might possibly include both a deterministic structure for the signal and/or autoregressive structure for the signal. Deterministic structure can include level shifts, local time trends (splines), seasonal(periodic) pulses and one-time pulses and sometimes in "physical/biological time series" sines,cosines and such but never in powers of time like quadratics/cubics etc.. Autoregressive structure can include the explicit incorporation of previous values. Errors from this "model" can often be characterized with an ARIMA structure thus further enhancing the signal. The final model should render a set of residuals that have a constant mean and variance. 
Your characterization implies that there might be identifiable "patches of residuals" , possibly having a "trend". I would suggest that you post your, perhaps scaled to hide the real data, and have some of the readers of your post to actually render a workable solution. You can then systematize their solution and incorporate it into your application.
You might want to review a similar thread as it deals with analysing time series data. How do I calculate projected figures for the next year based on past performance?
