# [R] error correcting a signal

Oliver Bandel oliver at first.in-berlin.de
Mon Mar 9 16:49:48 CET 2009

```Hello,

I know, this list is for R, not for mathematics,
but because of this problem in question, which may
be interesting for others too, I ask it here.

I want to correct a signal (timeseries).
There is a jump up, and later a jump down.
This error signal (must be an error, because
the normal data should not contain such a jump)
seems to be overlayed additive, but maybe also can have
a multiplicative error (scaling of a characteristic curve).
For both possibilities there are theoretic
reasons that would support the thesis.

The problem is, that the normal data is noisy
(meteorological data).

I tried correcting the signal with a scale-factor in the
timeframe, in which it occured. The corrected value looks good.
It's derivation has less anormalities.
That was good news.
The bad news: when I do a correction by subtraction of a constant
signal in the timeframe which contains the shifted signal,
the corrected signal also looks good (and it's derivation also
contains less abnormal jumps).

The complete sample has 29532 values.
The part with the shifted/multiplied signal values is 21379 values long.

I tried different approaches to detect a better match:
looking at the original and corrected values with my eyes,
looking for differentiation, looking at acf and fft/spectrum.

Now, R is a statistical program.
What about using more statistical approaches?
Could a variance analysis help?
So I could check both corrected and non-corrected values,
and compare them with the samples outside the shifted/multiplied part.

The problem here is, that the signals are quite noisy,
and the non-errorneous part is just a small part of the sample.

I hope this is an interesting question to the users of the list,
and apologize for such a non-R question.
I'm not a statistician, so apologize for maybe asking simple things. ;-)

Oliver

P.S.: I also have in mind do a correction with a complete characteristic curve,
which is just a function of y = a x + b    with different a.
But I have not done it so far. Maybe it is better than just using
the ad-hoc correction by a factor or an offset.
But maybe the methods you may recommend could help in detecting the
case of the problem very easily.

```