Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

Detecting outliers

Graphical methods are best for initially scanning for outliers. Boxplots, histograms, and normal probability plots are very useful tools.

In this code example, sales data is generated with an average sale of $10,000 and a standard deviation of $3,000. The boxplot shows some data above and below the whiskers of the diagram. Additionally, the histogram shows a gap between the highest bar and the one just below that. These are clues that potential outliers need to be looked at more closely:

set.seed(4070) #generate sales data outlier.df <-data.frame(sales=rnorm(100,mean=10000,sd=3000)) #plot the data, to possible outliers par(mfrow=c(1,2)) boxplot(outlier.df$sales, ylab="sales") hist(outlier.df$sales) 

Another way of looking ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content