Analyzing patterns and effects in history