Detect and replace outliers in data
finds
outliers in B
= filloutliers(A
,fillmethod
)A
and replaces them according to fillmethod
.
For example, filloutliers(A,'previous')
replaces
outliers with the previous non-outlier element. By default, an outlier
is a value that is more than three scaled median absolute deviations (MAD) away
from the median. If A
is a matrix or table, then filloutliers
operates
on each column separately. If A
is a multidimensional
array, then filloutliers
operates along the first
dimension whose size does not equal 1.
specifies a method for detecting outliers. For example,
B
= filloutliers(A
,fillmethod
,findmethod
)filloutliers(A,'previous','mean')
defines an outlier as an
element of A
more than three standard deviations from the
mean.
defines outliers as points outside of the percentiles specified in
B
= filloutliers(A
,fillmethod
,'percentiles',threshold
)threshold
. The threshold
argument is a
two-element row vector containing the lower and upper percentile thresholds, such as
[10 90]
.
specifies a moving method for detecting local outliers according to a window length
defined by B
= filloutliers(A
,fillmethod
,movmethod
,window
)window
. For example,
filloutliers(A,'previous','movmean',5)
identifies outliers as
elements more than three local standard deviations away from the local mean within a
five-element window.
specifies
additional parameters for detecting and replacing outliers using one
or more name-value pair arguments. For example, B
= filloutliers(___,Name,Value
)filloutliers(A,'previous','SamplePoints',t)
detects
outliers in A
relative to the corresponding elements
of a time vector t
.
[
also returns information about the position of the outliers and thresholds computed
by the detection method. B
,TF
,L
,U
,C
]
= filloutliers(___)TF
is a logical array indicating the
location of the outliers in A
. The L
,
U
, and C
arguments represent the lower and
upper thresholds and the center value used by the outlier detection method.
Clean Outlier
Data | fillmissing
| ismissing
| isoutlier
| rmoutliers