views:

85

answers:

2

Hi,

I'm writing a little tool that counts the downloads of an app. I save every download with a timestamp.

What algorithm (php and mysql) is normally used for predicting eg todays downloads?

Greets, Nick

+3  A: 

You could do Regression Analysis to predict the number of downloads on a given day. This image from Wikipedia shows some sample data points and the best-fit line. In case of downloads, the X axis could represents days, and Y axis could represent the number of downloads. Keeping that assumption, one would see that the number of downloads are going up each day on average.

Here's a good article explaining Linear Regression and IBM has written two articles on how to implement Simple Linear Regression with PHP (1, 2).

Also check out these other threads:

  1. http://stackoverflow.com/questions/1015424/occurrence-prediction/1015735#1015735
  2. http://stackoverflow.com/questions/891528/predictional-logic-in-programming/891595#891595
  3. http://stackoverflow.com/questions/758036/predict-next-event-occurrence-based-on-past-occurrences

alt text

Anurag
+1  A: 

The term you want is "extrapolation", there are some equations and further details described here: http://en.wikipedia.org/wiki/Extrapolation

In principle you need to pick an equation that matches your expected trend (linear, exponential etc) then you use the current data to find the parameters that best fit that equation to your data. Something like R-squared is a simple measure of best fit.

Once you've done a best-fit you can use the resulting equation parameters to extrapolate future data.

Paolo