Analyzing patterns and making predictions