I have a post which shows how to build a simple R model to predict demand for an item:
I am a huge fan of the Poisson distribution. It is special in that its one parameter (lambda) represents both the mean and the variance of the distribution. At the limit, a Poisson distribution becomes normal. But it’s most useful in helping us pattern infrequently-occurring events. For example, selling 3-4 watches per day.
Estimating a Poisson is also easy in R: lambda is simply the mean of your sample counts, and there is a function called
rpois()
which takes two parameters: the number of events you want to generate and the value of lambda.So what I want to do is take my data from SQL Server, feed it into R, and return back a prediction for the next seven days.
This was a simple post, but the next two in the series will expand upon it and build out a full implementation.