[R] remove outliers with scatterplotMatrix

John Fox jfox at mcmaster.ca
Thu Mar 19 19:08:46 CET 2015

Dear Roberto,

This is, I assume, the scatterplotMatrix() function in the car package.

There is no option for automatically removing outliers, although the various
options for labeling points should help you identify them. If you want to
remove outliers once identified, you could use the subset argument to
scatterplotMatrix(), much as you would for a statistical modeling function,
as long as the variables in the scatterplot matrix are specified in a

For example,

	scatterplotMatrix(~ income + education + prestige, data=Duncan,

identifies the two most noteworthy points in each panel (as explained in
?scatterplotMatrix), while

	scatterplotMatrix(~ income + education + prestige, data=Duncan,
subset= -c(6, 16))

removes cases 6 and 16.

I hope this helps,

John Fox, Professor
McMaster University
Hamilton, Ontario, Canada

> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Pagliari,
> Roberto
> Sent: March-19-15 11:07 AM
> To: r-help at r-project.org
> Subject: [R] remove outliers with scatterplotMatrix
> outliers may sometimes make a scatter plot less understandable.
> when using scatterplotMatrix, is it possible to automatically remove them?
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

This email has been checked for viruses by Avast antivirus software.

More information about the R-help mailing list