Correlate two signals
correlate_metricsResamples two health signals onto a common time grid and calculates their Pearson or Spearman correlation with p-value and sample size.
Instructions
Correlate two health signals aligned onto a common time grid.
Resamples each signal to one value per resample bucket (day/week/month)
with agg, inner-joins the buckets they share, then computes Pearson and/or
Spearman correlation with a two-sided p-value and the paired sample size.
Either signal may come from any source: metric, wearable, lab, biomarker,
substance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agg | No | how to collapse multiple readings in a bucket ('mean','median','sum','min','max','first','last','count'). | mean |
| user | No | which person; defaults to the primary user. | |
| since | No | ||
| until | No | ||
| method | No | 'pearson' | 'spearman' | 'both'. | both |
| name_a | Yes | ||
| name_b | Yes | ||
| lag_days | No | only with resample='day'. Positive values pair each A bucket with the B bucket `lag_days` days earlier (tests whether B leads A). | |
| resample | No | 'day' | 'week' | 'month' bucket granularity. | day |
| source_a | Yes | ||
| source_b | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||