trend-analysis

Detect statistically significant trends in time series data using linear regression and Mann-Kendall tests.

317|40|Updated Jan 21, 2025
One-click install
npx skills add https://github.com/benchflow-ai/benchflow --skill trend-analysis-benchflow-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trend-analysis
Source: https://github.com/benchflow-ai/benchflow/tree/main/tests/fixtures/skillsbench_slice/lake-warming-attribution/environment/skills/trend-analysis
Command: npx skills add https://github.com/benchflow-ai/benchflow --skill trend-analysis-benchflow-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires scipy, pymannkendall, pandas.

What problem does it solve?

This Skill addresses the difficulty of determining whether environmental or financial time series data exhibits a statistically significant long-term increase or decrease, removing the guesswork from trend identification.

Core Features & Use Cases

  • Parametric Analysis: Utilizes linear regression to fit trends to data that meets normality assumptions.
  • Non-Parametric Analysis: Employs the Mann-Kendall test and Sen's slope for robust trend detection that ignores outliers and non-normal distributions.
  • Use Case: Use this tool to analyze annual precipitation or temperature records to determine if a region is experiencing a statistically significant shift in climate patterns over the last decade.

Quick Start

Use the trend-analysis skill to calculate the Sen's slope and Mann-Kendall p-value for the time series data contained in the file precipitation.csv.

Frequently Asked Questions about trend-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect statistically significant trends in time series data?

To detect statistically significant trends in time series data, use linear regression for normal data and the Mann-Kendall test for non-normal distributions. This identifies long-term directional shifts while accounting for outliers in environmental or financial records.

When should I use the Mann-Kendall test instead of linear regression for trend analysis?

Use the Mann-Kendall test for trend analysis when your time series data lacks normality or contains outliers. Linear regression is parametric and best for normal data, whereas the non-parametric Mann-Kendall test provides robust trend detection without those distribution assumptions.

How do I calculate Sen's slope and Mann-Kendall p-values for a precipitation CSV file?

You calculate Sen's slope and the Mann-Kendall p-value for precipitation data by applying the pymannkendall library to your CSV dataset. This outputs a robust slope estimate and significance p-value to confirm if long-term climate patterns are statistically shifting.

Does this trend analysis tool work with pandas dataframes for environmental data?

Yes, trend analysis works with pandas dataframes for environmental data. It relies on pandas for data handling alongside scipy for regression and pymannkendall for significance testing, enabling you to process annual temperature or precipitation records efficiently.

What is the best way to analyze climate pattern shifts in annual temperature records?

The best way to analyze climate pattern shifts in annual temperature records is applying both parametric and non-parametric trend tests. Combining linear regression with the Mann-Kendall test determines whether a region experiences a statistically significant long-term increase or decrease.

What are the limitations of using linear regression for time series trend analysis?

A limitation of linear regression for time series trend analysis is its sensitivity to outliers and requirement for normally distributed data. When these assumptions fail, the non-parametric Mann-Kendall test and Sen's slope provide a more robust alternative for identifying long-term trends.