[R] Fitting data and removing outliers

David L Carlson dcarlson at tamu.edu
Fri Jul 13 21:17:23 CEST 2012


I didn't actually see any question in this posting, but instead of removing the outliers consider using a robust linear model.

library(MASS)
?rlm

The TeachingDemos package has a data set called outliers to show what can happen when you iteratively remove "outliers" in the way you suggest.

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352


----- Original Message ----- 

From: "Lauren Vogric" <lvogric at grahamcapital.com> 
To: r-help at r-project.org 
Sent: Friday, July 13, 2012 1:36:43 PM 
Subject: [R] Fitting data and removing outliers 

What I'm trying to do is create best fit line in R for a set of data points and then remove all the outliers to re-create a best fit. I can't use IQR because the outliers I have in mind are easily within the range, but way out of line for the best fit, which is ruining the fit. I'd rather throw out those points all together. 

Thanks! 

[[alternative HTML version deleted]] 

______________________________________________ 
R-help at r-project.org 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.



More information about the R-help mailing list