Correlation matrix
analytics_correlationCompute pairwise Pearson correlations between series in a stored result, aligning timestamps, converting prices to returns, and flagging pairs with too few shared points.
Instructions
Pairwise Pearson correlation of the series in one stored result (e.g. bars of several tickers, or returns), computed locally in DuckDB, in long form: one row per pair (a, b), both orders and the diagonal included. Each pair uses the timestamps where both series have a value. value_column defaults to the model's first value column; a column in price units (close) is turned into simple returns per pair first. A pair with fewer than min_overlap (20) shared observations gets None (insufficient_data). At most 50 series. Large outputs are stored and you get a result_id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | Pearson correlation. | pearson |
| result_id | Yes | A stored result holding several series (e.g. bars of several tickers, or returns). | |
| min_overlap | No | Fewest shared observations for a value; below it the cell is None. | |
| value_column | No | Numeric column to correlate. Default: the model's first value column (ret for returns, close for bars; ret for a query result that has one). A column in price units is turned into simple returns first. | |
| series_column | No | Column naming each series. Default: the result's group column. |