Find outliers in time series with unknown distributions I want to detect outliers in time series data like the two outliers in the image below.
At first I tried LOF, which didn't work well and outlier detection methods based on normal distributions wouldn't work.
The detection method should detect an observation as an outlier when there is an untypical change in the time series. 
Any suggestions what would be a good approach? 
(I am using R so far btw.)

 A: Your time-series looks similar to ion fluxes through single channels. If that is the case then you should probably look for well-established methods that take into account the physics and biochemistry of the system under study. Statisticians can help a bit, but you may be asking them to re-invent the wheel.
Maybe an approach like that described here would be good: https://www.researchgate.net/publication/258530467_Idealizing_Ion_Channel_Recordings_by_a_Jump_Segmentation_Multiresolution_Filter
A: A simplistic approach:


*

*The one on the top is easy, you just put a threshold $t$ (e.g. at t=15) on the data itself, i.e. you discard any points that have a value $y_i > t$.

*The other one can be caught with a threshold on the first order difference of the points, since it is several times further away from its neighbours than all the other points. That means you would discard any points that have a value $d_i = | y_i - y_{i-1} | > t$. This would also catch the first error.

*The second idea can be extended to the comment of tho_mi, where you would not only calculate $d_i$ but $\left | y_i - \sum_{j = i-10}^{i+10} y_j \right|$, i.e. the difference between $y_i$ and a running average around it.

A: I know it's been a while, but just for future users, one way can be to develop an XMR/SPC process control chart, and implement some rules, such as if a data point is 1/2/or 3 sigmas away from the moving average, it can be considered an outlier. Similarly, if consecutive points fall outside of sigma range, that group of points can be considered anomalies.
XMR charts have been used heavily to analyse process variability and stability.
