Correlation analysis helps you determine if two variables change in sync. Use this method when you want to see if an increase in one measurement, like temperature or marketing spend, typically corresponds with an increase or decrease in another, such as product yield or sales volume, across your dataset.
Understanding Relationships in Your Data
Correlation analysis quantifies the strength and direction of the link between two variables. Whether you are analyzing operational metrics, scientific measurements, or financial trends, this method provides a numerical value between -1 and +1. A value of +1 indicates a perfect positive relationship, while -1 indicates a perfect inverse relationship.
When you run this analysis in Lattice, you receive a clear breakdown of the relationship strength, accompanied by a p-value to help you determine if the observed pattern is statistically meaningful or likely due to random chance.
Choosing the Right Approach
Different types of data require different mathematical approaches to ensure accuracy. Pearson correlation is ideal for continuous data that follows a linear path. If your data is ranked or contains outliers, Spearman correlation is often more reliable because it focuses on the order of values rather than their exact magnitude.
For smaller samples, the Kendall correlation is a stable choice that remains accurate even when your dataset contains many repeated values. Lattice handles the complexity of these calculations, allowing you to focus on the findings rather than the underlying math.
Moving Beyond Individual Pairs
If you have a large dataset with many variables, looking at pairs one by one can be time-consuming. Lattice provides a correlation matrix, which creates a summary view of all variables at once. This heatmap-ready output highlights which variables are closely linked, allowing you to identify critical drivers in your data instantly.
Important Interpretations
While correlation is a powerful exploratory tool, it is not a test for cause and effect. Always consider external factors that might influence your results. For instance, if you see a strong correlation, ask yourself if a third variable—such as time, seasonal change, or a shared underlying process—could be the real reason behind the movement.
If you suspect a complex relationship exists, you can combine this analysis with scatter plots to visually confirm the shape of the data. If the relationship is non-linear or masked by extreme values, these visuals will help you determine the next steps for your investigation.
1 · Intent → method
An LLM picks stats_correlation 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.
Does a high correlation coefficient mean one variable causes the other?
No. The correlation coefficient only measures how variables change together. It cannot prove that one variable causes the other, as both could be influenced by a third hidden factor.
Which method should I choose for my data?
Lattice automatically selects the best fit: Pearson for linear relationships, Spearman for monotonic trends or ranked data, and Kendall for smaller datasets with many repeating values.
Tool input schema
Schema for stats_correlation not exported yet (run pnpm export:registry).