异常值识别
使用quantile找出75%分位数,大于其三倍。三倍于标准差之上的数据为异常值。
set.seed(2019)
x <- runif(200)
qq <- quantile(x)
out <- 1.5 * (qq[4]-qq[2])
plot(x[x>=out], col = 1, xlim = c(2, 100), ylim = c(0, 1))
points(x[x<out], col = 2)
legend("topright",legend = c("outlier","normal"), pch=1,col=1:2)