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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source_a": "<source_a>",
"name_a": "<name_a>",
"source_b": "<source_b>",
"name_b": "<name_b>"
},
"name": "correlate_metrics"
}
}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 | |||