Many health studies conclude that exercise, group therapy, or community activities improve mental health because they create social support. The standard tool behind these claims is mediation analysis. It splits an intervention's effect into an indirect part that flows through a middle variable (support received) and a direct part that bypasses it. Today these analyses rest on small, centrally collected questionnaire samples. The richest record of the support people actually receive sits in their private messages and peer-support chats, which cannot legally or ethically be pooled. Federated learning trains models where the data lives and sends only summaries to a server, so it looks like the obvious fix. The catch is that on a phone, "support received" is never observed directly. It is the output of an on-device text classifier, and classifier errors shrink the estimated indirect effect in a predictable direction. A study run this way would systematically conclude that interventions work "directly" rather than through social support. That is exactly the wrong answer for the question this literature asks.
We propose a federated mediation procedure built for the cross-device setting. Each person is one client and contributes repeated daily observations. The mediator is a machine-learned score of effective social support computed from that person's incoming messages. Using a small consented calibration subsample, the procedure estimates the classifier's error rates and corrects the indirect effect for them. It also handles binary clinical endpoints such as a PHQ-9 depression cutoff. Only secure sums of low-dimensional statistics leave the device. The claim is that measurement error in a learned mediator, not the number of devices, is what breaks naive federated mediation at the edge, and that it can be corrected with provable coverage at modest calibration cost.
What already exists and where the gap actually is
Distributed mediation analysis with communication efficiency is the closest work. Each silo fits two linear regressions and sends two t-statistics. The server combines them into distributed Sobel and MaxP tests, which match a pooled-data oracle when the number of silos $K$ grows slower than $\sqrt{N}$. The paper also shows that naive p-value averaging loses almost all power. That result motivates our design and rules out the meta-analysis shortcut. The paper assumes continuous outcomes, linear models, directly measured mediators, and few large silos.
We read the $K<\sqrt{N}/2$ restriction differently from the research file's Gap 4. It is a consequence of averaging t-statistics, not a limit of federated computation. Linear models can be fit exactly by securely summing each client's cross-product matrices. Logistic models can be fit exactly by running federated Newton steps on summed gradients and Hessians. Neither requires any condition on $K$. We therefore do not claim to "rescue" the $K$ bound, and we do not use clustered federated learning (Clustered Federated Learning: A Review) to shrink the effective number of silos. Clustering would add the cluster-identity leakage that review warns about, for example exposing that a user sits in a "high-distress" cluster, and it would buy nothing that exact aggregation does not already give. The genuinely unsolved pieces are the mismeasured mediator and the binary endpoint.
Two lines of work supply the measurement instruments. RedditESS labels peer replies that help-seekers confirmed as helpful. It finds Validation (26.6%) and shared lived experience (21.9%) dominate effective support, and trains a RoBERTa detector reaching 76% accuracy and 85% F1. Everything is scraped centrally, and the paper does no mediation analysis. FedTherapist shows a frozen-BERT-plus-small-head model runs on phones in about 219MB of RAM and reaches 0.775 AUROC for depression screening from users' own language. It is purely predictive and ignores incoming support. We reuse FedTherapist's on-device architecture and RedditESS's labels to build the mediator detector.
The error rate these papers report is the heart of our problem. A 76%-accurate detector is good for prediction and poor as a direct stand-in for the mediator. Engagement Patterns of Peer-to-Peer Interactions on Mental Health Platforms supplies a second, structural mediator: "mutual discourse," meaning sustained back-and-forth between seeker and supporters. It is linked to 75% versus 64% seeker retention on TalkLife and can be computed from thread metadata without reading content.
The substantive motivation comes from survey studies. Examples include exercise and self-deficiency mediated by social support and tai chi and walking in older adults living alone, mediated by social participation. Both rely on cross-sectional questionnaires. The adolescent sports and suicide review explicitly calls for longitudinal evidence. Daily within-person data from phones is what those designs lack.
Core Claim
Let $X$ be the exposure (for example, a day with group activity), $M$ the true support received, $\hat M$ the on-device classifier's score, and $Y$ the outcome. Suppose $M$ is replaced by $\hat M$, and $\hat M$ has reliability $\lambda \in (0,1]$, the share of its variance that reflects true support rather than error. Then the classic errors-in-variables result for linear models gives
$$\hat b_{\text{naive}} \approx \lambda\, b, \qquad \hat c'_{\text{naive}} \approx c' + (1-\lambda)\, a\, b,$$
where $a$ is the effect of $X$ on $M$, $b$ is the effect of $M$ on $Y$, and $c'$ is the direct effect. In words, the indirect effect $ab$ shrinks and the missing part is misattributed to the direct path.
We claim three things. First, $\lambda$, or for a binary detector its sensitivity and specificity, can be estimated from a calibration subsample of a few hundred person-days that consented to human annotation. Second, a corrected estimator can be computed entirely from secure sums of per-client statistics. Third, the corrected federated test achieves nominal confidence-interval coverage and pooled-oracle power, where the naive plug-in does not. For binary outcomes the linear correction does not transfer. We will use a misclassification-corrected likelihood fit by federated Newton steps, with a sandwich variance estimate built from summed per-client score outer products. That variance estimate respects the repeated-measures structure within each phone.
Research Program
The system has three layers.
The first layer is the mediator detector. It is a frozen-encoder support classifier pretrained on RedditESS. It is then adapted federatedly on-device, with only its small head updated by federated averaging. It scores each incoming message for validation and shared experience. A parallel, content-free mediator counts mutual-discourse episodes from message metadata.
The second layer is calibration. For a random consented subset of clients, a sample of their messages is annotated with the RedditESS taxonomy. This can happen on-device by the user or through a secure enclave. The resulting confusion counts are securely summed to estimate error rates. We will study how many calibration person-days are needed for the corrected intervals to reach nominal coverage.
The third layer is the mediation estimator itself. Each client computes its local contributions: cross-products for the linear case, and gradients, Hessians, and score outer products for the logistic case. These use person-mean-centered daily data, which removes stable between-person confounding. The server sees only secure-aggregated sums, optionally with differential-privacy noise, and returns the corrected indirect effect with a confidence interval.
Our analysis will derive the corrected estimator's asymptotic variance, including the extra uncertainty from estimating $\lambda$. It will also characterize the privacy cost: what the summed statistics reveal and how much noise the tests tolerate before losing power.
Baselines
The naive reference point is local mediation at each site followed by averaging p-values or indirect effects. The distributed-mediation paper already shows this collapses to near-zero power as silos multiply. We include it so the magnitude of that collapse is visible in our cross-device regime, where each client holds only tens of days.
The strongest existing method is the distributed Sobel and MaxP test of Distributed mediation analysis with communication efficiency. On its educational dataset it reports p = 0.0007 for distributed MaxP where every single site gave p > 0.05. In simulation it reports oracle-matching power and Type I control up to K = 32. We run it with exactly our data partitions and the same plug-in mediator. That isolates two failures. At large $K$, it fails the $\sqrt{N}$ condition. With a classifier mediator, it inherits the attenuation. There is no reported result found on Lacuna for any federated or distributed mediation method on mental-health or social-support data, so our numbers will be the first on these benchmarks.
The pooled oracle fits the same corrected model on centralized data. Our federated estimator should match it to numerical precision in point estimate and interval, since aggregation is exact. Any gap signals a bug rather than a statistical cost.
The key ablation removes calibration. It runs exact federated aggregation with the raw classifier score as mediator. Beating this ablation is the proposal's central test. The corrected estimator must reach 95% nominal coverage for the indirect effect, within Monte Carlo error, where the ablation's coverage falls well below. It must also recover the true indirect effect with less than 10% relative bias where the ablation's bias scales with $1-\lambda$.
We also compare against a passive-sensor mediator in the style of FedHealth and the StudentLife graph model, using co-location or call counts. This tests whether text is needed at all. All methods receive the same clients, rounds, and hyperparameter search budget.
Why not just…?
Why not just securely sum sufficient statistics and skip everything else? We do. That is how our estimator avoids the $K<\sqrt{N}/2$ restriction. But exact aggregation only reproduces the pooled answer, and the pooled answer with a 76%-accurate mediator is biased toward "no mediation." The no-calibration ablation is precisely this alternative, and the semi-synthetic experiments measure how badly it misses the known truth.
Why not just measure support with a periodic questionnaire and run standard mediation centrally? This is a real competitor when support is stable and weekly resolution suffices. A validated scale does have lower measurement error than a text classifier. It cannot resolve day-level, within-person dynamics, and the questionnaire answers themselves still sit in separate institutions. In our design the questionnaire becomes the calibration instrument rather than the whole study. We will report, on StudentLife, whether the text-based corrected estimate adds precision beyond a survey-only analysis on the same subjects. If it does not, that is a publishable negative result about when phone-derived mediators are worth their privacy cost.
Why not just train a better detector until error is negligible? Attenuation scales with $1-\lambda$, and no detector in the file approaches negligible error. RedditESS's best is 76% accuracy. Detector error will also differ across people and platforms, so a centrally validated accuracy does not tell you the error on a new cohort. Calibrating on the target population is still required. We will show that correction stays useful across detector quality by sweeping the detector's accuracy in simulation.
Why not use clustered federated learning to handle heterogeneous users? Heterogeneity in mediation effects is better modeled as between-person variation in the regression coefficients, estimated from the same summed statistics. Clustering would publish a psychiatric-profile label per user, the leakage the clustered-FL review flags, without improving exactness.
Proposed Experiments
Semi-synthetic study. The first study builds simulated users from RedditESS threads. For each simulated person, we sample daily exposure days, attach real incoming replies whose true support labels come from the Golden set, and generate outcomes from a known model. Outcomes are both continuous and binary at a clinical-style threshold, with specified $a$, $b$, and $c'$. We vary the number of clients from 32 to 10,000, days per client from 10 to 70, calibration size, and detector accuracy by swapping in weaker or stronger RoBERTa checkpoints. Metrics are relative bias of $ab$, 95% interval coverage, Type I error under $ab=0$, and power. The decisive check is that coverage holds for the corrected estimator across all $K$, while both the plug-in ablation and distributed MaxP undercover as detector error grows.
Mutual-discourse variant. Using the Reddit portion of the peer-interaction data, we repeat the analysis with mutual discourse as a content-free mediator. This tests whether the structural signal survives when message text is never read.
Real-data check on StudentLife. The third study uses StudentLife's 48 students over 10 weeks, simulating one client per student. Exposure is days with high physical activity. Mediators are social contact derived from conversation and co-location, with a subsample-based calibration against self-reported sociability. Outcomes are daily stress and the PHQ-9 cutoff. With only 48 people the power is limited, so the primary check is agreement between the federated and pooled estimates. The secondary finding is whether the corrected indirect effect is larger than the naive one, as the attenuation argument predicts. The STGNN's reported stress F1 of 65.4 ± 3.1 and PHQ-9 RMSE of 3.5 ± 3.1 serve only as a sanity check that our features carry comparable predictive signal, not as a mediation baseline.
Privacy stress test. Finally, we add calibrated differential-privacy noise to the summed statistics and record the privacy budget at which power drops below 80% for a fixed moderate indirect effect. This tells deployers what privacy costs statistically.
References
- Distributed mediation analysis with communication efficiency
- Clustered Federated Learning: A Review
- RedditESS: A Mental Health Social Support Interaction Dataset - Understanding Effective Social Support to Refine AI-Driven Support Tools
- FedTherapist: Mental Health Monitoring with User-Generated Linguistic Expressions on Smartphones via Federated Learning
- Engagement Patterns of Peer-to-Peer Interactions on Mental Health Platforms
- The influence of college students' exercise participation on feelings of self-deficiency: the mediating effect of social support
- Effects of tai chi, ba duan jin, and walking on the mental health status of urban older people living alone: the mediating role of social participation and the moderating role of the exercise environment
- Can sports participation be a protective factor against suicide-related outcomes in adolescents: a systematic review
- FedHealth: A Federated Transfer Learning Framework for Wearable Healthcare