I'm trying to figure out a good inventory forecasting algorithm for wine sales.

I have the following characteristics so far:

  1. Wine sales are cyclical and not seasonal
  2. Have incomplete time series: not every day/week are there sales
  3. It should be sensitive to change and outliers: there could be one order with 20 bottles of wine, or 5 orders with 4 bottles each.

Trying to forecast sales into a specific amount of days in the future.

Tried linear regression to predict if the sales trend is going up or down, which gave somewhat accurate predictions, but in many cases it was way off, even for three years worth of sales data.

  • $\begingroup$ There are many algorithms that can help with predicting sales. Time-Series based and not. Which features do you have? How does your data set look like? What is considered a good solution(how accurate? how do you measure accuracy?) - the more details the more chances someone will be able to help you $\endgroup$
    – yoav_aaa
    Commented Oct 30, 2019 at 11:28
  • 4
    $\begingroup$ Are these truly "incomplete" data in the sense that you just don't know the sales on some days; or is it simply that case that your data show some days have no sales? The difference in interpretation is huge. $\endgroup$
    – whuber
    Commented Oct 30, 2019 at 14:14
  • $\begingroup$ @whuber Yes, there are days when there are no sales. I can see every placed order in my ecommerce platform, so thi sisn't the case where I don't know if there were sales or not. $\endgroup$
    – feketegy
    Commented Nov 1, 2019 at 11:54
  • $\begingroup$ @whuber My dataset looks like this https://pastebin.com/7f8uxWis $\endgroup$
    – feketegy
    Commented Nov 1, 2019 at 12:05
  • 1
    $\begingroup$ Ah, that dramatically simplifies things. You do have complete data and you can (and should!) just insert zeros for those days. You may still need to account for things like overdispersion, but there's no need to aggregate or use methods for handling irregularly-spaced data. $\endgroup$ Commented Nov 4, 2019 at 13:39

1 Answer 1


You have reported that you have transaction data . Since you don't have observations every day, you will need to aggregate/bucket your data to a time series i.e. some level of accumulation ...where non-zero observations are present. An example might be weekly or monthly buckets or even quarterly buckets.

Buying patterns are seldomly weekly-based with resultant calendar complications when we have 53 weeks in the year and more frequently are monthly based. Post one of your example time series and I will try and help further.

If you have price history and possibly price expectations that might be useful in developing useful forecasts from a useful model.


Classic time series analysis deals with analyzing data that is bucketed with respect to time be it daily , weekly , monthly , quarterly or annularly. Model identification is accomplished by examining autoregression coefficients both unconditional and conditional aka. ACF and PACF.

There is a requirement that the data set be complete sometimes filled in with a few missing points. You don't have enough data points and your data is not a "fixed time interval" but reflects daily transactions ( bucketted over daily activity)

The standard acceptable solution is to employ Intermittent Demand Models where the rate of demand is predicted form the # of time periods between points of demand. The rich history can be pursued here on SE https://stats.stackexchange.com/search?tab=newest&q=INTERMITTENT%20DEMAND summarizes recent material on this subject/approach.

In that spirit I took your 13 days of demand and formed the following data matrix enter image description here

I formed a regression model between demand and interval while dealing with two unusual data points reflecting anomalous values. enter image description here

The Actual.Fit and Forecast graph is hereenter image description here suggesting that 3 bottles if wine are the expecation per day.

It would be interesting to me to see this data set analyzed in other ways as has been reflected by the comments section and then we might do some meaningful comparison.

This kind of problem arises naturally in predicting when and how many gallons of gas will be acquired for the family auto.

  • 3
    $\begingroup$ Re "you will need to aggregate:" that's not necessarily so. Indeed, that's usually a second-rate choice in many situations due to the information it potentially loses. Aggregation is required only if one feels a need to use the techniques implemented in your software. $\endgroup$
    – whuber
    Commented Oct 30, 2019 at 14:15
  • $\begingroup$ au contraire .... having equally spaced data and using autocorrelation functions to identoify the memory structure is the GOLD STANDARD to empirically develop a history based prediction. If the data is not equally spaced the acf is tarnished big time. $\endgroup$
    – IrishStat
    Commented Oct 30, 2019 at 16:05
  • $\begingroup$ This is a manifestation of your hammer syndrome: one can conceive of a "gold standard" only in a world where the only known models are derived from an ARIMA-like analysis of a regularly spaced time series dataset. In the present case, the irregular times of sales at the very least suggest considering alternative models. Without any consideration of that possibility, it's hard to see how your "gold standard" claim could possibly be supported. $\endgroup$
    – whuber
    Commented Oct 30, 2019 at 16:17
  • $\begingroup$ My limited experience of some 55 years looking at chronological data suggests to me that if the data is unevenly spaced one can only fit deterministic trend variables like T , T squared etc. >In one of your useful comments I believe you reflected negatively on these kinds of models.stats.stackexchange.com/questions/21365/… " "fitting polynomials to data can be a deceptively poor approach": $\endgroup$
    – IrishStat
    Commented Oct 30, 2019 at 16:21
  • $\begingroup$ There are plenty of ways to model unevenly spaced data. Indeed, the majority of geostatistical techniques are dedicated to doing exactly that in any number of dimensions. To those one can add various hidden and latent variable models as well as GLMs based on stochastic processes. $\endgroup$
    – whuber
    Commented Oct 30, 2019 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.