getOutliers is a wrapper function for getOutliersI and getOutliersII.
getOutliers(y, method="I", ...)
getOutliersI(y, rho=c(1,1), FLim=c(0.1,0.9), distribution="normal")
getOutliersII(y, alpha=c(0.05, 0.05), FLim=c(0.1, 0.9),
distribution="normal", returnResiduals=TRUE)
Number of left and right outliers.
Index vector indicating left outliers in y
Index vector indicating right outiers in y
For Method I: y-values below (above) limit[1] (limit[2]) are outliers. For Method II: elements with residuals below (above) limit[1] (limit[2]) are outliers if all smaller (larger) elements are outliers as well.
The used method: "method I" or "method II"
The used model distribution
FLim[1]
FLim[2]
Smallest y-value used in fit
Largest y-value used in fit
Number of values used in the fit
Method I, the input rho-values for left and right outliers
Method II, the input confidence levels for left and right outliers
R-squared value for the fit. Note that this is the ordinary least squares value, defined by
(exponential distribution) Estimated location (and spread) parameter for
(lognormal distribution) Estimated
(lognormal distribution) Estimated
(pareto distribution) Estimated location parameter (mode) for pareto distribution
(pareto distribution) Estimated spread parameter for pareto distribution
(weibull distribution) estimated shape parameter
(weibull distribution) estimated scale parameter
(normal distribution) Estimated
(normal distribution) Estimated
Vector of one-dimensional nonnegative data
"I" or "II"
Optional arguments to be passed to getOutliersI or getOutliersII
Model distribution used to estimate the limit. Choose from "lognormal", "exponential", "pareto", "weibull" or "normal" (default).
c(Fmin,Fmax) quantile limits indicating which data should be used to fit the model distribution. Must obey 0 < Fmin < Fmax < 1.
(Method I) A value
(Method II) A value
(Method II) Whether or not to return a vector of residuals from the fit
Mark van der Loo, see www.markvanderloo.eu
Both methods use the subset of
M.P.J. van der Loo, Distribution based outlier detection for univariate data. Discussion paper 10003, Statistics Netherlands, The Hague. Available from www.markvanderloo.eu or www.cbs.nl.
The file <your R directory>/R-<version>/library/extremevalues/extremevalues.pdf contains a worked example. It can also be downloaded from my website.
y <- rlnorm(100)
y <- c(0.1*min(y),y,10*max(y))
K <- getOutliers(y,method="I",distribution="lognormal")
L <- getOutliers(y,method="II",distribution="lognormal")
par(mfrow=c(1,2))
outlierPlot(y,K,mode="qq")
outlierPlot(y,L,mode="residual")
Run the code above in your browser using DataLab