Use the time series trend test when you need to understand the direction of your data over time, such as tracking daily active users, manufacturing yields, or clinical outcomes. This method helps you distinguish between meaningful shifts and random fluctuations, providing a clear summary of whether your metrics are consistently moving upward, downward, or remaining stable.
Understanding Data Direction
Determining if your metrics are improving or declining is often complicated by daily volatility. This tool cuts through the noise by examining the overall movement of your data points rather than just comparing the start and end values.
By applying both regression and rank-based testing, the platform generates a final 'trend direction' that represents the most reliable consensus of your data's behavior.
How the Dual-Method Approach Works
The tool uses a two-pronged strategy. First, it applies linear regression to calculate the rate of change per unit of time. Second, it runs a Mann-Kendall test, which evaluates the consistency of the trend without being overly influenced by massive spikes or drops.
This combination is particularly useful for operational data, where temporary anomalies are common. If the two methods provide conflicting signals, the tool highlights this discrepancy, allowing you to focus on the more conservative, robust result.
Handling Time and Data Quality
The tool automatically detects and formats your time columns, whether they are dates, timestamps, or simple sequential indices. It performs necessary data cleaning—such as handling missing values or ensuring observations are in chronological order—before running any analysis.
To maintain data integrity, the tool ensures that you have enough data points to produce a valid conclusion, providing clear feedback if the sample size is too small to reliably detect a trend.
Clear Results for Decision Making
Instead of just providing raw coefficients, the analysis provides plain-language outputs like 'increasing', 'decreasing', or 'stationary'. This allows you to integrate findings directly into reports or business discussions without needing to manually interpret p-values or complex statistics.
1 · Intent → method
An LLM picks ts_detect_trend from a fixed catalog.
2 · Method → numbers
Deterministic Python engine runs the math. Same input → same output.
3 · Numbers → plain language
A second LLM translates the result into your domain’s vocabulary.
Why does Lattice run two different methods for the same trend?
Real-world data often contains outliers or irregular patterns. By running both linear regression and the Mann-Kendall test, we cross-verify results. If they agree, the trend is clear; if they differ, the test provides a warning so you don't misinterpret a single extreme data point as a long-term trend.
What happens if my data is not perfectly linear?
The time series trend test is designed for this. While linear regression looks for a straight-line fit, the included Mann-Kendall test is non-parametric, meaning it doesn't assume your data follows a strict line or normal distribution. It excels at identifying trends even when data is messy or skewed.
Tool input schema
Schema for ts_detect_trend not exported yet (run pnpm export:registry).