how can I Replace outliers with median of previous observations?
Show older comments
Hello i have some outliers in a 206*174 dataset matrix.. I want to replace them with the median of the 5 previous observaitons using a loop..
how can i do that?
[EDITED, copied from Answer section, Jan]
i will be more clear.. outliers are observations of stationary series with absolute deviations from the median which exceed six times the interquartile range. I want to replace them with the median of the preceding five observations. thanks
7 Comments
If you post, what you have done so far, inserting the required changes would be easier. Please explain, what "previous" exactly mean, when you operate on a matrix. And specify what you mean by "outlier" - did you have a method to detect them already? If not, how are they recognized?
Nicolas
on 19 Jul 2012
you just need to say, no need for the find
Y(Y==outlieres) = X;
Please post clarifications of the question by editing the question. This is the location, where readers expect all necessary information.
Let me ask you again: What does "preceding" mean, when you process a matrix? The 5 rows before, the 5 columns before, 5 other matrices processed before? Do you have the indices of the outlöiers already or is this a part of the question?
The more time we waste with guessing, the less time is left for answering.
Nicolas
on 19 Jul 2012
Nicolas
on 19 Jul 2012
Nicolas
on 19 Jul 2012
Answers (1)
something like this should work
yourthreshold = 10;
Data(Data>yourthreshold) = median(median(Data));
this replaces all values being greater than 10.
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!