简体   繁体   English

分位数函数消除R中的离群值

[英]Quantile function eliminating outlier in r

I want to make numeric values into quantile categories in R and until now I used 我想将数值分成R中的分位数类别,直到现在为止

ntile

function. 功能。 But I am pretty not sure how this function calculate quantile values like it possesses outliers too or not. 但是我不太确定这个函数如何计算分位数,就像它是否具有离群值。 Is there any other way to eliminating outliers when obtaining quantile values, please let me know. 获取分位数时是否还有其他方法可以消除异常值,请告诉我。

Perhaps you just want to know the method of removing values from a dataset before running quantile? 也许您只是想知道在运行分位数之前从数据集中删除值的方法?

test <- rnorm(100) # Generate data (assuming you can get an outlier)
bp <- boxplot(test) # box plot is a simple way to identify outliers
outlier <- which(test == bp$out) # get the position of those outliers in your data
quantile(test[-outlier]) # remove them as you use the quantile function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM