1

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?

Bundy
  • 311
  • 7
  • 25
  • Do you mean average downloads per day, per day of the week, given certain trends... ? How are you using this, just displaying it? – JAL Jan 10 '10 at 09:30
  • It's indeed like a trend. I want to know how many downloads there will be taking account with previous days. – Bundy Jan 10 '10 at 09:37

2 Answers2

5

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. Occurrence prediction
  2. Predictional Logic in Programming?
  3. Predict next event occurrence, based on past occurrences

alt text
(source: wikimedia.org)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Anurag
  • 140,337
  • 36
  • 221
  • 257
1

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
  • 22,188
  • 6
  • 42
  • 49