DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

Detecting out of line signal

Started by Marc2050 ●May 25, 2011
On May 26, 4:17&#4294967295;am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:
> >On May 25, 2:11=A0am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > >> Hi. > > >> I've a bunch of signal data. 4000 points. > >> I plot this 4000 points on an amplitude vs time axes. > >> After I plot them, some points are completely "out of line". > >> That is, visually you can see that they are sticking out. Way out > >> compare to the rest of the data. The values are something like > >> 291334000000.00 while the normal values are in the range of 36131.00. > >> As a result, when I plot them to include all points, the data are flat > >> with > >> just a few lines that correspond to the out of line signal. > > >> How do I adjust my axes automatically at the point when I plot them so > th= > >at > >> I could see the normal points and signals like a usual plot. I dont > reall= > >y > >> care about the extreme values. > > >> So far, I tried using mean but because the extreme values skewed the > enti= > >re > >> mean too much, it isnt helpful. Any advise please? > > >> Thank you. > > >There was a lot of research being done on outliers, but your case > >_appears_ &#4294967295;to fairly simple. Use a MEDIAN filter. I would recommend a > >5th order or 7th order filter to start. For the simple case you have, > >it should clear it up automatically. > > >Maurice Givens > > But a MEDIAN filter will modify your data? If I only want to > remove/ignore/replace the outliners, WITHOUT modifying the original and the > rest of the data, then is MEDIAN filter still suitable?
The median filter helps to *detect* the outlier, which is the hard part. Once you know that a point likely is an outlier, it is up to you what to do next. You can remove the point, tag it, or do whatever else you like. Again, the hard part is to find the outlier points. Rune
On May 25, 11:45&#4294967295;pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> On May 26, 4:17&#4294967295;am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > > > > > > > >On May 25, 2:11=A0am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > > >> Hi. > > > >> I've a bunch of signal data. 4000 points. > > >> I plot this 4000 points on an amplitude vs time axes. > > >> After I plot them, some points are completely "out of line". > > >> That is, visually you can see that they are sticking out. Way out > > >> compare to the rest of the data. The values are something like > > >> 291334000000.00 while the normal values are in the range of 36131.00. > > >> As a result, when I plot them to include all points, the data are flat > > >> with > > >> just a few lines that correspond to the out of line signal. > > > >> How do I adjust my axes automatically at the point when I plot them so > > th= > > >at > > >> I could see the normal points and signals like a usual plot. I dont > > reall= > > >y > > >> care about the extreme values. > > > >> So far, I tried using mean but because the extreme values skewed the > > enti= > > >re > > >> mean too much, it isnt helpful. Any advise please? > > > >> Thank you. > > > >There was a lot of research being done on outliers, but your case > > >_appears_ &#4294967295;to fairly simple. Use a MEDIAN filter. I would recommend a > > >5th order or 7th order filter to start. For the simple case you have, > > >it should clear it up automatically. > > > >Maurice Givens > > > But a MEDIAN filter will modify your data? If I only want to > > remove/ignore/replace the outliners, WITHOUT modifying the original and the > > rest of the data, then is MEDIAN filter still suitable? > > The median filter helps to *detect* the outlier, which is > the hard part. Once you know that a point likely is an > outlier, it is up to you what to do next. You can remove > the point, tag it, or do whatever else you like. > > Again, the hard part is to find the outlier points. > > Rune- Hide quoted text - > > - Show quoted text -
Rune, The median filter will remove the outlier.
On May 25, 9:17&#4294967295;pm, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote:
> >On May 25, 2:11=A0am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > >> Hi. > > >> I've a bunch of signal data. 4000 points. > >> I plot this 4000 points on an amplitude vs time axes. > >> After I plot them, some points are completely "out of line". > >> That is, visually you can see that they are sticking out. Way out > >> compare to the rest of the data. The values are something like > >> 291334000000.00 while the normal values are in the range of 36131.00. > >> As a result, when I plot them to include all points, the data are flat > >> with > >> just a few lines that correspond to the out of line signal. > > >> How do I adjust my axes automatically at the point when I plot them so > th= > >at > >> I could see the normal points and signals like a usual plot. I dont > reall= > >y > >> care about the extreme values. > > >> So far, I tried using mean but because the extreme values skewed the > enti= > >re > >> mean too much, it isnt helpful. Any advise please? > > >> Thank you. > > >There was a lot of research being done on outliers, but your case > >_appears_ &#4294967295;to fairly simple. Use a MEDIAN filter. I would recommend a > >5th order or 7th order filter to start. For the simple case you have, > >it should clear it up automatically. > > >Maurice Givens > > But a MEDIAN filter will modify your data? If I only want to > remove/ignore/replace the outliners, WITHOUT modifying the original and the > rest of the data, then is MEDIAN filter still suitable?- Hide quoted text - > > - Show quoted text -
Removing the outlier _modifies_ the original. The question is how much modification can you tollerate. For the sequence [1, 2, 3, 4, 20, 6, 7, 8], 20 is an outlier. With a 3rd-order median filter the output is the sequence [0, 1, 2, 3, 4, 6, 7, 7]. Can you tollerate this small amount of modification? Also, the median filter will preserve amplitude shifts. for the sequence [1, 2, 2, 2, 5, 5, 6, 6], the output of a 3rd-order median is [0, 1, 2, 2, 2, 5, 5, 6]. Again, you must determine how much your signal can be modified and be acceptable. The median filter will remove the outliers, maintain any amplitude shifts, and do it automatically, in real time. Maurice Givens
On 5/25/2011 9:45 PM, Rune Allnor wrote:
> On May 26, 4:17 am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> wrote: >>> On May 25, 2:11=A0am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> wrote: >>>> Hi. >> >>>> I've a bunch of signal data. 4000 points. >>>> I plot this 4000 points on an amplitude vs time axes. >>>> After I plot them, some points are completely "out of line". >>>> That is, visually you can see that they are sticking out. Way out >>>> compare to the rest of the data. The values are something like >>>> 291334000000.00 while the normal values are in the range of 36131.00. >>>> As a result, when I plot them to include all points, the data are flat >>>> with >>>> just a few lines that correspond to the out of line signal. >> >>>> How do I adjust my axes automatically at the point when I plot them so >> th= >>> at >>>> I could see the normal points and signals like a usual plot. I dont >> reall= >>> y >>>> care about the extreme values. >> >>>> So far, I tried using mean but because the extreme values skewed the >> enti= >>> re >>>> mean too much, it isnt helpful. Any advise please? >> >>>> Thank you. >> >>> There was a lot of research being done on outliers, but your case >>> _appears_ to fairly simple. Use a MEDIAN filter. I would recommend a >>> 5th order or 7th order filter to start. For the simple case you have, >>> it should clear it up automatically. >> >>> Maurice Givens >> >> But a MEDIAN filter will modify your data? If I only want to >> remove/ignore/replace the outliners, WITHOUT modifying the original and the >> rest of the data, then is MEDIAN filter still suitable? > > The median filter helps to *detect* the outlier, which is > the hard part. Once you know that a point likely is an > outlier, it is up to you what to do next. You can remove > the point, tag it, or do whatever else you like. > > Again, the hard part is to find the outlier points. > > Rune
Yes. Both Rune and Maury have made good suggestions. In a straightforward median filter - often used on images - it would modify the data very likey more frequently and it will cause repeated values - for whatever that might be worth. Images do often have fields that are the same color so that makes a lot of sense. Otherwise there's going to be a pixel standing out that's just a bit off. And, as both Rune and I have pointed out: there is a detection process and a replacement process. They need not be tied together. So, you could use the median filter or some other approach for detection and then use an altogether different approach for replacement post-detection / triggering. Applied to a median filter more or less directly, if you don't want to change any of the other data points then you would only apply it *if* the order suggested using a different value. Then you could determine that value to be used in the replacement independently. Applied to the differencing filter I suggested, the values are an interpolation of those around it - so the change seems less "nonlinear" but if the formula is only going to be used now and then, well, I guess that's pretty nonlinear. If you care about not changing values of samples (which seems consistent with only dealing with outliers) then using the filter with a suitable threshold as a detector will generate fewer changes compared to a median filter. If you use the filter alternate output that I suggested then it's just a simple line fit on the adjacent samples. If you use the median filter output then it's just a repetition of that adjacent sample that's in the same direction as the outlier. One could use a parabolic fit to further bias the output in the direction of the outlier. ... and so forth. It interesting to ask the question: "Which method generates the least noise in the resulting data?" Well, I couldn't come up with much of a basis for making the measurement. i.e. "what *is* noise in this case?" I guess one measure would be to simply count the number of data points that have been changed. If you stick with changing only the deemed "outliers" then that must be a minimum. Then the question becomes "by how much?" which gets quickly to "why?". - There are any variety of ways to interpolate that either leave out the value of the outlier or biasing the interpolation in the direction of the outlier - which doesn't leave it out entirely. For example: y(3)= k1*x(2) + k2*x(3) + k3*x(4) would be an example where x(3) is the outlier and pick your own coefficients where [k1 k2 k3] might be something like [0.45 0.1 0.45]. One case I used had [0.5 0 0.5] so zero bias on the outlier. The median filter uses [0 0 1] or [1 0 0] to make the bias limited to making the sample equal to the nearest-valued sample. So, there are plenty of methods that won't change the data too often and only when and where you want to. Fred
On May 26, 11:52&#4294967295;am, Fred Marshall <fmarshallxremove_th...@acm.org>
wrote:
> On 5/25/2011 9:45 PM, Rune Allnor wrote: > > > > > > > On May 26, 4:17 am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> &#4294967295;wrote: > >>> On May 25, 2:11=A0am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> &#4294967295;wrote: > >>>> Hi. > > >>>> I've a bunch of signal data. 4000 points. > >>>> I plot this 4000 points on an amplitude vs time axes. > >>>> After I plot them, some points are completely "out of line". > >>>> That is, visually you can see that they are sticking out. Way out > >>>> compare to the rest of the data. The values are something like > >>>> 291334000000.00 while the normal values are in the range of 36131.00. > >>>> As a result, when I plot them to include all points, the data are flat > >>>> with > >>>> just a few lines that correspond to the out of line signal. > > >>>> How do I adjust my axes automatically at the point when I plot them so > >> th= > >>> at > >>>> I could see the normal points and signals like a usual plot. I dont > >> reall= > >>> y > >>>> care about the extreme values. > > >>>> So far, I tried using mean but because the extreme values skewed the > >> enti= > >>> re > >>>> mean too much, it isnt helpful. Any advise please? > > >>>> Thank you. > > >>> There was a lot of research being done on outliers, but your case > >>> _appears_ &#4294967295;to fairly simple. Use a MEDIAN filter. I would recommend a > >>> 5th order or 7th order filter to start. For the simple case you have, > >>> it should clear it up automatically. > > >>> Maurice Givens > > >> But a MEDIAN filter will modify your data? If I only want to > >> remove/ignore/replace the outliners, WITHOUT modifying the original and the > >> rest of the data, then is MEDIAN filter still suitable? > > > The median filter helps to *detect* the outlier, which is > > the hard part. Once you know that a point likely is an > > outlier, it is up to you what to do next. You can remove > > the point, tag it, or do whatever else you like. > > > Again, the hard part is to find the outlier points. > > > Rune > > Yes. &#4294967295;Both Rune and Maury have made good suggestions. > > In a straightforward median filter - often used on images - it would > modify the data very likey more frequently and it will cause repeated > values - for whatever that might be worth. &#4294967295;Images do often have fields > that are the same color so that makes a lot of sense. &#4294967295;Otherwise there's > going to be a pixel standing out that's just a bit off. > > And, as both Rune and I have pointed out: there is a detection process > and a replacement process. &#4294967295;They need not be tied together. > So, you could use the median filter or some other approach for detection > and then use an altogether different approach for replacement > post-detection / triggering. > Applied to a median filter more or less directly, if you don't want to > change any of the other data points then you would only apply it *if* > the order suggested using a different value. &#4294967295;Then you could determine > that value to be used in the replacement independently. > Applied to the differencing filter I suggested, the values are an > interpolation of those around it - so the change seems less "nonlinear" > but if the formula is only going to be used now and then, well, I guess > that's pretty nonlinear. > > If you care about not changing values of samples (which seems consistent > with only dealing with outliers) then using the filter with a suitable > threshold as a detector will generate fewer changes compared to a median > filter. > > If you use the filter alternate output that I suggested then it's just a > simple line fit on the adjacent samples. > If you use the median filter output then it's just a repetition of that > adjacent sample that's in the same direction as the outlier. > One could use a parabolic fit to further bias the output in the > direction of the outlier. > ... and so forth. > > It interesting to ask the question: "Which method generates the least > noise in the resulting data?" &#4294967295;Well, I couldn't come up with much of a > basis for making the measurement. &#4294967295;i.e. "what *is* noise in this case?" > I guess one measure would be to simply count the number of data points > that have been changed. &#4294967295;If you stick with changing only the deemed > "outliers" then that must be a minimum. &#4294967295;Then the question becomes "by > how much?" which gets quickly to "why?". > - There are any variety of ways to interpolate that either leave out the > value of the outlier or biasing the interpolation in the direction of > the outlier - which doesn't leave it out entirely. &#4294967295;For example: > > y(3)= k1*x(2) + k2*x(3) + k3*x(4) > > would be an example where x(3) is the outlier and pick your own > coefficients where [k1 k2 k3] might be something like [0.45 0.1 0.45]. > One case I used had [0.5 0 0.5] so zero bias on the outlier. > > The median filter uses [0 0 1] or [1 0 0] to make the bias limited to > making the sample equal to the nearest-valued sample. > > So, there are plenty of methods that won't change the data too often and > only when and where you want to. > > Fred- Hide quoted text - > > - Show quoted text -
Fred, I'm going to _pick some nits_ here. [0 0 1] and [1 0 0] are order- statistic filters, but not median filters. By definition, if the order of the filter is odd, then the median filter will have all zeros except the middle element, e.g. [0 1 0], [0 0 1 0 0]. If the order is even, the two middle coefficients would have the value 1/2, e.g. [0 0 1/2 1/2 0 0]. Maurice
On 5/26/2011 10:35 AM, maury wrote:
> On May 26, 11:52 am, Fred Marshall<fmarshallxremove_th...@acm.org> > wrote: >> On 5/25/2011 9:45 PM, Rune Allnor wrote: >> >> >> >> >> >>> On May 26, 4:17 am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> wrote: >>>>> On May 25, 2:11=A0am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> wrote: >>>>>> Hi. >> >>>>>> I've a bunch of signal data. 4000 points. >>>>>> I plot this 4000 points on an amplitude vs time axes. >>>>>> After I plot them, some points are completely "out of line". >>>>>> That is, visually you can see that they are sticking out. Way out >>>>>> compare to the rest of the data. The values are something like >>>>>> 291334000000.00 while the normal values are in the range of 36131.00. >>>>>> As a result, when I plot them to include all points, the data are flat >>>>>> with >>>>>> just a few lines that correspond to the out of line signal. >> >>>>>> How do I adjust my axes automatically at the point when I plot them so >>>> th= >>>>> at >>>>>> I could see the normal points and signals like a usual plot. I dont >>>> reall= >>>>> y >>>>>> care about the extreme values. >> >>>>>> So far, I tried using mean but because the extreme values skewed the >>>> enti= >>>>> re >>>>>> mean too much, it isnt helpful. Any advise please? >> >>>>>> Thank you. >> >>>>> There was a lot of research being done on outliers, but your case >>>>> _appears_ to fairly simple. Use a MEDIAN filter. I would recommend a >>>>> 5th order or 7th order filter to start. For the simple case you have, >>>>> it should clear it up automatically. >> >>>>> Maurice Givens >> >>>> But a MEDIAN filter will modify your data? If I only want to >>>> remove/ignore/replace the outliners, WITHOUT modifying the original and the >>>> rest of the data, then is MEDIAN filter still suitable? >> >>> The median filter helps to *detect* the outlier, which is >>> the hard part. Once you know that a point likely is an >>> outlier, it is up to you what to do next. You can remove >>> the point, tag it, or do whatever else you like. >> >>> Again, the hard part is to find the outlier points. >> >>> Rune >> >> Yes. Both Rune and Maury have made good suggestions. >> >> In a straightforward median filter - often used on images - it would >> modify the data very likey more frequently and it will cause repeated >> values - for whatever that might be worth. Images do often have fields >> that are the same color so that makes a lot of sense. Otherwise there's >> going to be a pixel standing out that's just a bit off. >> >> And, as both Rune and I have pointed out: there is a detection process >> and a replacement process. They need not be tied together. >> So, you could use the median filter or some other approach for detection >> and then use an altogether different approach for replacement >> post-detection / triggering. >> Applied to a median filter more or less directly, if you don't want to >> change any of the other data points then you would only apply it *if* >> the order suggested using a different value. Then you could determine >> that value to be used in the replacement independently. >> Applied to the differencing filter I suggested, the values are an >> interpolation of those around it - so the change seems less "nonlinear" >> but if the formula is only going to be used now and then, well, I guess >> that's pretty nonlinear. >> >> If you care about not changing values of samples (which seems consistent >> with only dealing with outliers) then using the filter with a suitable >> threshold as a detector will generate fewer changes compared to a median >> filter. >> >> If you use the filter alternate output that I suggested then it's just a >> simple line fit on the adjacent samples. >> If you use the median filter output then it's just a repetition of that >> adjacent sample that's in the same direction as the outlier. >> One could use a parabolic fit to further bias the output in the >> direction of the outlier. >> ... and so forth. >> >> It interesting to ask the question: "Which method generates the least >> noise in the resulting data?" Well, I couldn't come up with much of a >> basis for making the measurement. i.e. "what *is* noise in this case?" >> I guess one measure would be to simply count the number of data points >> that have been changed. If you stick with changing only the deemed >> "outliers" then that must be a minimum. Then the question becomes "by >> how much?" which gets quickly to "why?". >> - There are any variety of ways to interpolate that either leave out the >> value of the outlier or biasing the interpolation in the direction of >> the outlier - which doesn't leave it out entirely. For example: >> >> y(3)= k1*x(2) + k2*x(3) + k3*x(4) >> >> would be an example where x(3) is the outlier and pick your own >> coefficients where [k1 k2 k3] might be something like [0.45 0.1 0.45]. >> One case I used had [0.5 0 0.5] so zero bias on the outlier. >> >> The median filter uses [0 0 1] or [1 0 0] to make the bias limited to >> making the sample equal to the nearest-valued sample. >> >> So, there are plenty of methods that won't change the data too often and >> only when and where you want to. >> >> Fred- Hide quoted text - >> >> - Show quoted text - > > Fred, > I'm going to _pick some nits_ here. [0 0 1] and [1 0 0] are order- > statistic filters, but not median filters. By definition, if the order > of the filter is odd, then the median filter will have all zeros > except the middle element, e.g. [0 1 0], [0 0 1 0 0]. If the order is > even, the two middle coefficients would have the value 1/2, e.g. [0 0 > 1/2 1/2 0 0]. > > Maurice
Maurice, As I understand it, the median filter picks the median value in a set. I was using a set of 3. A "median filter" isn't a linear filter. So I simply defined the linear filter that it applies in its midst. Even that isn't linear because it isn't applied consistently. So, for illumination, the effective filter on those 3 points in their original order is going to be: [1 0 0] or [0 1 0] or [0 0 1] And the choice of which one is determined by the ordering and selection process. Perhaps that's a different way of saying it but it's correct as nearly as I can tell. And, I don't understand where you get [0 1 0] *all* the time .. if that's what you meant .. in view of the ordering and selection. AH! you apply this filter after the ordering - of course. In words: "Replace each sample with the median of the sample and the two adjacent samples". So, nothing is changed if the sample *is* the median. If it's not, then it's replaced by one of its neighbors - whichever is closer. Now, in the case of median filters on 4 samples, I understand it this way: "Replace each sample with the median of the samples". This is not always [0 1/2 1/2 0] until after the ordering. So I would have said the "filters" are either: [1/2 1/2 0 0} [1/2 0 1/2 0] [1/2 0 0 1/2] [0 1/2 1/2 0] [0 1/2 0 1/2] [0 0 1/2 1/2] applied to the original samples in their original order. We agree. Fred
On May 26, 6:01&#4294967295;pm, maury <maury...@core.com> wrote:
> On May 25, 11:45&#4294967295;pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > > > On May 26, 4:17&#4294967295;am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > > > > >On May 25, 2:11=A0am, "Marc2050" <maarcc@n_o_s_p_a_m.gmail.com> wrote: > > > >> Hi. > > > > >> I've a bunch of signal data. 4000 points. > > > >> I plot this 4000 points on an amplitude vs time axes. > > > >> After I plot them, some points are completely "out of line". > > > >> That is, visually you can see that they are sticking out. Way out > > > >> compare to the rest of the data. The values are something like > > > >> 291334000000.00 while the normal values are in the range of 36131.00. > > > >> As a result, when I plot them to include all points, the data are flat > > > >> with > > > >> just a few lines that correspond to the out of line signal. > > > > >> How do I adjust my axes automatically at the point when I plot them so > > > th= > > > >at > > > >> I could see the normal points and signals like a usual plot. I dont > > > reall= > > > >y > > > >> care about the extreme values. > > > > >> So far, I tried using mean but because the extreme values skewed the > > > enti= > > > >re > > > >> mean too much, it isnt helpful. Any advise please? > > > > >> Thank you. > > > > >There was a lot of research being done on outliers, but your case > > > >_appears_ &#4294967295;to fairly simple. Use a MEDIAN filter. I would recommend a > > > >5th order or 7th order filter to start. For the simple case you have, > > > >it should clear it up automatically. > > > > >Maurice Givens > > > > But a MEDIAN filter will modify your data? If I only want to > > > remove/ignore/replace the outliners, WITHOUT modifying the original and the > > > rest of the data, then is MEDIAN filter still suitable? > > > The median filter helps to *detect* the outlier, which is > > the hard part. Once you know that a point likely is an > > outlier, it is up to you what to do next. You can remove > > the point, tag it, or do whatever else you like. > > > Again, the hard part is to find the outlier points. > > > Rune- Hide quoted text - > > > - Show quoted text - > > Rune, > The median filter will remove the outlier.
If you apply it as a black box, then yes. If, on the other hand, you figure out how it works, you can use the detection stage to find outliers, and instead of removing the outlier points, as the median filter does, do something else. Rune
On May 26, 2:23=A0pm, Fred Marshall <fmarshallxremove_th...@acm.org>
wrote:
> On 5/26/2011 10:35 AM, maury wrote: > > > > > > > On May 26, 11:52 am, Fred Marshall<fmarshallxremove_th...@acm.org> > > wrote: > >> On 5/25/2011 9:45 PM, Rune Allnor wrote: > > >>> On May 26, 4:17 am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> =A0 =A0w=
rote:
> >>>>> On May 25, 2:11=3DA0am, "Marc2050"<maarcc@n_o_s_p_a_m.gmail.com> =
=A0 =A0wrote:
> >>>>>> Hi. > > >>>>>> I've a bunch of signal data. 4000 points. > >>>>>> I plot this 4000 points on an amplitude vs time axes. > >>>>>> After I plot them, some points are completely "out of line". > >>>>>> That is, visually you can see that they are sticking out. Way out > >>>>>> compare to the rest of the data. The values are something like > >>>>>> 291334000000.00 while the normal values are in the range of 36131.=
00.
> >>>>>> As a result, when I plot them to include all points, the data are =
flat
> >>>>>> with > >>>>>> just a few lines that correspond to the out of line signal. > > >>>>>> How do I adjust my axes automatically at the point when I plot the=
m so
> >>>> th=3D > >>>>> at > >>>>>> I could see the normal points and signals like a usual plot. I don=
t
> >>>> reall=3D > >>>>> y > >>>>>> care about the extreme values. > > >>>>>> So far, I tried using mean but because the extreme values skewed t=
he
> >>>> enti=3D > >>>>> re > >>>>>> mean too much, it isnt helpful. Any advise please? > > >>>>>> Thank you. > > >>>>> There was a lot of research being done on outliers, but your case > >>>>> _appears_ =A0to fairly simple. Use a MEDIAN filter. I would recomme=
nd a
> >>>>> 5th order or 7th order filter to start. For the simple case you hav=
e,
> >>>>> it should clear it up automatically. > > >>>>> Maurice Givens > > >>>> But a MEDIAN filter will modify your data? If I only want to > >>>> remove/ignore/replace the outliners, WITHOUT modifying the original =
and the
> >>>> rest of the data, then is MEDIAN filter still suitable? > > >>> The median filter helps to *detect* the outlier, which is > >>> the hard part. Once you know that a point likely is an > >>> outlier, it is up to you what to do next. You can remove > >>> the point, tag it, or do whatever else you like. > > >>> Again, the hard part is to find the outlier points. > > >>> Rune > > >> Yes. =A0Both Rune and Maury have made good suggestions. > > >> In a straightforward median filter - often used on images - it would > >> modify the data very likey more frequently and it will cause repeated > >> values - for whatever that might be worth. =A0Images do often have fie=
lds
> >> that are the same color so that makes a lot of sense. =A0Otherwise the=
re's
> >> going to be a pixel standing out that's just a bit off. > > >> And, as both Rune and I have pointed out: there is a detection process > >> and a replacement process. =A0They need not be tied together. > >> So, you could use the median filter or some other approach for detecti=
on
> >> and then use an altogether different approach for replacement > >> post-detection / triggering. > >> Applied to a median filter more or less directly, if you don't want to > >> change any of the other data points then you would only apply it *if* > >> the order suggested using a different value. =A0Then you could determi=
ne
> >> that value to be used in the replacement independently. > >> Applied to the differencing filter I suggested, the values are an > >> interpolation of those around it - so the change seems less "nonlinear=
"
> >> but if the formula is only going to be used now and then, well, I gues=
s
> >> that's pretty nonlinear. > > >> If you care about not changing values of samples (which seems consiste=
nt
> >> with only dealing with outliers) then using the filter with a suitable > >> threshold as a detector will generate fewer changes compared to a medi=
an
> >> filter. > > >> If you use the filter alternate output that I suggested then it's just=
a
> >> simple line fit on the adjacent samples. > >> If you use the median filter output then it's just a repetition of tha=
t
> >> adjacent sample that's in the same direction as the outlier. > >> One could use a parabolic fit to further bias the output in the > >> direction of the outlier. > >> ... and so forth. > > >> It interesting to ask the question: "Which method generates the least > >> noise in the resulting data?" =A0Well, I couldn't come up with much of=
a
> >> basis for making the measurement. =A0i.e. "what *is* noise in this cas=
e?"
> >> I guess one measure would be to simply count the number of data points > >> that have been changed. =A0If you stick with changing only the deemed > >> "outliers" then that must be a minimum. =A0Then the question becomes "=
by
> >> how much?" which gets quickly to "why?". > >> - There are any variety of ways to interpolate that either leave out t=
he
> >> value of the outlier or biasing the interpolation in the direction of > >> the outlier - which doesn't leave it out entirely. =A0For example: > > >> y(3)=3D k1*x(2) + k2*x(3) + k3*x(4) > > >> would be an example where x(3) is the outlier and pick your own > >> coefficients where [k1 k2 k3] might be something like [0.45 0.1 0.45]. > >> One case I used had [0.5 0 0.5] so zero bias on the outlier. > > >> The median filter uses [0 0 1] or [1 0 0] to make the bias limited to > >> making the sample equal to the nearest-valued sample. > > >> So, there are plenty of methods that won't change the data too often a=
nd
> >> only when and where you want to. > > >> Fred- Hide quoted text - > > >> - Show quoted text - > > > Fred, > > I'm going to _pick some nits_ here. [0 0 1] and [1 0 0] are order- > > statistic filters, but not median filters. By definition, if the order > > of the filter is odd, then the median filter will have all zeros > > except the middle element, e.g. [0 1 0], [0 0 1 0 0]. If the order is > > even, the two middle coefficients would have the value 1/2, e.g. [0 0 > > 1/2 1/2 0 0]. > > > Maurice > > Maurice, > > As I understand it, the median filter picks the median value in a set. > I was using a set of 3. > > A "median filter" isn't a linear filter. =A0So I simply defined the linea=
r
> filter that it applies in its midst. =A0Even that isn't linear because it > isn't applied consistently. > > So, for illumination, the effective filter on those 3 points in their > original order is going to be: > [1 0 0] > or > [0 1 0] > or > [0 0 1] > And the choice of which one is determined by the ordering and selection > process. > Perhaps that's a different way of saying it but it's correct as nearly > as I can tell. =A0And, I don't understand where you get [0 1 0] *all* the > time .. if that's what you meant .. =A0in view of the ordering and > selection. =A0AH! you apply this filter after the ordering - of course. > > In words: > "Replace each sample with the median of the sample and the two adjacent > samples". > So, nothing is changed if the sample *is* the median. > If it's not, then it's replaced by one of its neighbors - whichever is > closer. > > Now, in the case of median filters on 4 samples, I understand it this way=
:
> "Replace each sample with the median of the samples". =A0This is not > always [0 1/2 1/2 0] until after the ordering. =A0So I would have said th=
e
> "filters" are either: > [1/2 1/2 0 0} > [1/2 0 1/2 0] > [1/2 0 0 1/2] > [0 1/2 1/2 0] > [0 1/2 0 1/2] > [0 0 1/2 1/2] > applied to the original samples in their original order. > > We agree. > > Fred- Hide quoted text - > > - Show quoted text -
Right!! The median filter is an order-statistic filter in the family of L- estimators, which means the elements must first be placed in assending order. Then, if the number of elements is odd, the median is the middle element. If the number of elements is even, the median is the mean of the two middle elements. The position of the median can be found by (n+1)/2n where n is the number of elements. Makes it very easy for computer implementation: use an odd number of elements, sort the data, use the middle element. A good book that covers the median filter is Nonlilnear Digital Filters: Principles and Applications by Pitas and Venetsanopoulos. Maurice