Detecting and predicting trends