statistics - R - print outlier from a datafram -


i want extract outliers data frame. 10 out of 1000 data points possible outliers or doesn't fall in 95% confidence interval. there ways find value largest difference between , sample mean.

> <- c(1,3,2,4,5,2,3,90,78,56,78,23,345) > require("outliers") > outlier(a) [1] 345 

i don't want remove outliers dataframe or boxplot. want print or subset them.

any ideas?

given data:

a <- c(1,3,2,4,5,2,3,90,78,56,78,23,345) 

if want values not within 95% confidence. have keep in mind confidence concept of probability of "true mean".

in case:

> mean(a) [1] 53.07692 

first question answer: 53 "normal" value expect? why ask it? because if want print values not within 95%:

a[a > mean(a) + qt(0.975, df = length(a) - 1) * mean(a) / sqrt(length(a)) |     < mean(a) - qt(0.975, df = length(a) - 1) * mean(a) / sqrt(length(a))]  [1]   1   3   2   4   5   2   3  90 345 

you might more expect, in case.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -