I was hoping someone could help me! How do you exclude outliers from a set of data? Thanks, Laura [[alternative HTML version deleted]]
Hi, On Sun, 3 Oct 2004, Laura Collins wrote:> How do you exclude outliers from a set of data?Your question is too vague. I'm assuming you have a data frame and already know exactly which observations are the outlier(s). If your data frame is called foo.df, and say observation 5 is an outlier, then something like: foo.df[-5, ] will exclude it. Kevin -------------------------------- Ko-Kang Kevin Wang PhD Student Centre for Mathematics and its Applications Building 27, Room 1004 Mathematical Sciences Institute (MSI) Australian National University Canberra, ACT 0200 Australia Homepage: http://wwwmaths.anu.edu.au/~wangk/ Ph (W): +61-2-6125-2431 Ph (H): +61-2-6125-7407 Ph (M): +61-40-451-8301
Dear Laura,> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Laura Collins > Sent: Sunday, October 03, 2004 7:57 AM > To: R-help at stat.math.ethz.ch > Subject: [R] Excluding data in R > > I was hoping someone could help me! > > How do you exclude outliers from a set of data? >It depends upon the context, but it could be as simple as using a negative subscript; for example x[-c(5, 9)] removes the fifth and ninth element from the vector x. This kind of information is available in every introduction to R that I've seen, including the introductory manual that comes with R. I hope that this helps, John
On 3 Oct 2004 at 13:56, Laura Collins wrote:> I was hoping someone could help me! > > > > How do you exclude outliers from a set of data?It depends strongly on your definition of outliers. You can apply some rules of thumb (e.g. points more than 3 sd apart) but it is quite often questionable. (see discussion few days ago). If you already identified your outliers use my.data[-outliers.points] in case of vector or my.data[-outliers.points,] in case of data frame or matrix. Cheers Petr> > > > Thanks, > > > > Laura > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.htmlPetr Pikal petr.pikal at precheza.cz