IQR_outliers | R Documentation |
Outlier detection with interquartile range (IQR) based distances, defined as:
lower limit Q1 - k * IQR
and
upper limit Q3 + k * IQR
. Here Q1 and Q3 is the first and the
third quantile respectively.
Inner lower/upper limit for probable outlier detection has k = k_inn
and
outer lower/upper limit for (extreme) outlier detection has k = k_out
,
(k_out > k_inn
).
IQR_outliers(x, k_out = 3, k_inn = 1.5)
x |
Matrix-like data or |
k_out |
Number of IQR distances from Q1 and Q3 for |
k_inn |
Number of IQR diustances from Q1 and Q3 for |
A list with these variables
outer / inner - matrices with values of outer / inner limits respectively
Logical matrices indicating TRUE
for points that are:
is_out - (extreme) outliers (excluding probable outliers);
is_pout - probable outliers (excluding extreme outliers);
is_bothOut - either probable or extreme outliers;
Logical vectors indicating spectra / rows with at least one:
row_out - (extreme) outlier point;
row_pout - probable outlier point (excluding extreme outliers);
row_bothOut - either probable or extreme outlier point.
If x is a hyperSpec
object, then the listed variables are returned as
hyperSpec
objects.
Note that probable outliers are points between corresponding lower as
well as corresponding upper inner
and outer
limits.
Extreme outliers are points outside lower and upper outer
limits.
Vilmantas Gegzna
Read about boxplots and outliers (Box Plot: Display of Distribution)
Other spHelper utilities:
expr2text()
,
mad_outliers()
,
rmExpr()
,
sd_outliers()
,
subt()
,
unGroup()
,
uncall()
Other spHelper functions for spectroscopy and hyperSpec:
binning()
,
file
,
gapDer()
,
hy2mat()
,
hyAdd_Label_wl()
,
hyAdd_Labels_PAP_PD_2014()
,
hyAdd_Labels_TD2009()
,
hyAdd()
,
hyDrop_NA()
,
hyGet_palette()
,
hyRm_palette()
,
mad_outliers()
,
mean_Nsd()
,
median_Nmad()
,
plot_hyPalette()
,
prepare_PAP_RK_2014__MATLAB_failui()
,
read.OOIBase32()
,
read.OceanView.header()
,
read.OceanView()
,
read.sp.csv2()
,
read3csv2hy()
,
replace_spc()
,
sd_outliers()
,
spStat()
,
sp_class_perform()
Other outlier detection functions in spHelper:
mad_outliers()
,
sd_outliers()
outl <- IQR_outliers(Spectra2)
plot(outl$outer, col = NA)
plot(Spectra2, add = TRUE, spc.nmax = nrow(Spectra2))
plot(outl$outer, add = TRUE, col = "red", lines.args = list(lwd = 3))
plot(outl$inner, add = TRUE, col = "orange", lines.args = list(lwd = 3))
legend("topright",legend=c("Outer limit", "Inner limit", "Spectra"),
col = c("red", "orange", "black"), lwd = c(3,3,1), lty = 1)
title("IQR based distances")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.