how can I Replace outliers with median of previous observations?
显示 更早的评论
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 个评论
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
2012-7-19
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
2012-7-19
Nicolas
2012-7-19
Nicolas
2012-7-19
回答(1 个)
something like this should work
yourthreshold = 10;
Data(Data>yourthreshold) = median(median(Data));
this replaces all values being greater than 10.
类别
在 帮助中心 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!