How to Delete entries for which the mid-quote deviated by more than 10 mean absolute deviations from a rolling centered median (excluding the observation under consideration) of 50 observations (25 observations before and 25 after).

3 views (last 30 days)
I have a cell array of midquotes split on days. I need to Delete entries for which the mid-quote deviated by more than 10 mean absolute deviations from a rolling centered median (excluding the observation under consideration) of 50 observations (25 observations before and 25 after) for EACH DAY. How to do it with R2016a.

Answers (1)

KSSV
KSSV on 7 Jan 2019
Let A be your data vector, which has outliers and you want to remove:
idx = abs(A - mean(T)) > 3*std(T); % get indices
A(idx) = [] ; % remove them
YOu can run a loop or use Cellfun to use the above lines of code to remove outliers in a cell.
  4 Comments
NS
NS on 7 Jan 2019
I have a cell array A which is indexed to DATETIME index idx and i need to perform this function on 8th column of each cell of cell array . I ran this code and got Index exceeds matrix dimension error .
[idx1] = cellfun(@(x){abs(x - mean(x) > 3*std(x))},A(:,8),'UniformOutput',false);
Kindly help how to remove the outliers from each cell within this code ?

Sign in to comment.

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!