O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Looking at the distributions

Now we can take a look at the distribution of the number of items. We can see by using the mean() function that there is an average of ~27 items. This will be a large enough assortment of items to do a meaningful analysis:

mean(x2$itemcount)

This is the following output:

> [1] 27 

We can also plot a histogram:

hist(x2$itemcount, breaks = 500, xlim = c(0, 50))  

The histogram shown next shows a definite spike at the low end. We know that the data cannon contains single invoices (count=1), since we have already filtered them out:

To verify this, we can inspect the itemcount frequencies via a table. Run the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required