Hi,

I am trying to restrict a data set so as not to included outliers.  
Specifically, I would like to specify a percentage where a fraction of 
observations are eliminated from the data set, much in the same way that the 
trimmed mean function works - but leaving the restricted data set intact.

I have been using a function which will restrict the data set using:
> trim=function(x,p){
> o=order(x)
> xo=x[o]
> n=length(xo)
> tl=round(n*p)
> print(xo[(tl+1):(n-tl)])}

However I was wondering if anyone knew a more elegant and simple method to get 
the same result.

Thanks in advance.


 
---------------------------------
Don't pick lemons.

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to