Outliers, removing 1st and 99th percentiles in dataset

4 ビュー (過去 30 日間)
alex monjambo
alex monjambo 2014 年 9 月 21 日
コメント済み: alex monjambo 2014 年 9 月 23 日
Hi, here is my problem :
I have a dataset called "COMP" which includes many variables such as DY, etc...
The variable "DY" includes many zeros (approx 59300) and some negative numbers while the reste is positive for a total of 90483 observations.
I would like to create a function that removes the rows for the observations below the 1st and above the 99th percentiles.
Here is what i have been trying so far :
COMP = sortrows(COMP,'DY','ascend'); find(COMP.DY == prctile(COMP.DY,1))
The problem is that i dont want to remove all the zeros .. just the 1st percentile ....
Thanks for your help

採用された回答

Roger Wohlwend
Roger Wohlwend 2014 年 9 月 22 日
p = prctile(COMP.DY, [1 99]);
COMP.DY(COMP.DY <= p(1)) = [];
COMP.DY(COMP.DY >= p(2)) = [];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by