What is the best way to detect trends in item popularity?

Assume I have kept track of the number of views per page and I want to show trending pages.

I am thinking about applying some statistical tests like Log-likelihood/chi-squared to detect breakthroughs from the popularity expectation.

Can somebody point me to some resources related to this matter?

-
add comment

2 Answers

One simple approach is to use an exponentially weighted moving average. This tends to emphasize recent data, while retaining some history.

For example, each hour you could update the estimated popularity $y$ for a page by updating your estimate as follows: $y := (1-\alpha) y + \alpha x$, where $x$ denotes some measure of its popularity over the past hour (e.g., number of visits) and $\alpha$ is a constant that determines how rapidly the estimate discounts older values.

You could then sort pages by their estimated popularity. Pages with a high estimate are "trending".

-
add comment

There is the Cochran-Armitage trend test for linear models but along the lines of D.W.s answer you can view the data as a time series. The generalization of exponential smoothing is the ARIMA model structure. The approach to identify trends in ARIMA models is to calculate the estimate of the autocorrelatioon function. If the function is positive and slowly declining that is an indication of trend (informal).

-
add comment