Quantifying Weather Impact on Mental Well-Being
Statistics & ExperimentsModel answerLast updated
Design an observational study using panel data to isolate the causal impact of ambient temperature on daily mood scores while controlling for confounders and reporting bias.
You work for a digital health platform that tracks daily self-reported emotional well-being scores (on an integer scale from $1$ to $10$) from users across the globe. The product management team wants to understand the true causal effect of daily local outdoor temperature on user-reported mood.
You are given two high-volume datasets:
user_mood: Logs containinguser_id,date,zip_code, andmood_score.weather_metrics: Logs containingzip_code,date,max_temperature,precipitation, andsunlight_hours.
Design a comprehensive econometric/statistical framework to estimate this effect. In your answer, address the following:
- Variables & Units: Specify the exact treatment and outcome variables, along with the appropriate unit of analysis.
- Confounding & Bias: Describe at least three primary sources of bias or confounding that would invalidate a naive regression model.
- Identification Strategy: Formulate a statistical model that isolates the causal relationship from unobserved shocks and fixed differences.
- Validation & Sensitivity: Outline specific diagnostic and placebo tests to verify that your model captures a genuine causal link rather than a spurious correlation.
Hints
Hint 1
Avoid cross-sectional comparisons between geographic regions, as regions differ in baseline happiness, cost of living, and demographics.
Hint 2
Consider using fixed effects at the user, geographic, and calendar levels to absorb unobserved heterogeneity.
Hint 3
Think about whether the act of logging a mood score itself is influenced by outdoor weather conditions (selection bias).
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer Framework
Estimating the impact of environmental factors like temperature on subjective well-being using observational data presents a classic causal inference challenge. A simple correlation between temperature and mood will fail because warm places differ systematically from cold places, and warm seasons differ from cold seasons in ways that independently affect mood.
The core strategy is to exploit short-term, quasi-random temperature fluctuations relative to local seasonal norms within individual users over time.
1. Variables and Estimand Definition
- Treatment Variable ($T_{z,t}$): Daily maximum local temperature in zip code $z$ on date $t$. Daily maximum reflects outdoor conditions during waking hours when exposure is highest. Rather than assuming a linear effect, temperature should be discretized into non-overlapping bins (e.g., $<0^\circ\text{C}$, $0\text{--}5^\circ\text{C}$, $\dots$, $>35^\circ\text{C}$) to capture non-linear dynamics (such as extreme heat discomfort vs. mild warmth benefits).
- Outcome Variable ($Y_{i,z,t}$): Self-reported mood score ($1\text{--}10$) logged by user $i$ in zip code $z$ on date $t$.
- Unit of Analysis: User-day $(i, t)$.
- Target Estimand: The Average Treatment Effect (ATE) of experiencing a temperature bin relative to a baseline bin (e.g., $18\text{--}22^\circ\text{C}$), conditional on location-specific seasonal expectations and individual baselines.
2. Key Sources of Bias and Confounding
A naive regression of $Y_{i,z,t}$ on $T_{z,t}$ suffers from several distinct confounding mechanisms:
-
Geographic Confounding (Location Fixed Differences):
- Problem: Regions with higher average temperatures (e.g., California) may systematically differ from cooler regions (e.g., Minnesota) in income distribution, lifestyle, urban infrastructure, and access to outdoor activities.
- Bias: Confounding baseline geography with the effect of temperature.
-
Seasonal and Time-of-Year Confounding:
- Problem: Summer months bring higher temperatures along with longer daylight hours, academic holidays, and summer vacations. These macro factors raise mood independently of raw heat.
- Bias: Attributing summer joy entirely to temperature.
-
Co-occurring Weather Factors:
- Problem: Daily temperature correlates strongly with precipitation and cloud cover. Extreme heat often accompanies clear skies, while cool days may be overcast or rainy.
- Subtlety: Controlling for sunshine changes the estimand to "the effect of temperature holding sunshine constant." This distinction must be explicitly noted based on product goals.
-
Selective Reporting Bias (Differential Missingness):
- Problem: Users may be less inclined to open an app and log their mood on extremely sunny, pleasant days because they are spending time outdoors, or on very poor weather days due to lethargy.
- Bias: If only unhappy people log scores on hot days, the estimated impact of heat will be downward-biased.
3. Identification Strategy: Panel Fixed-Effects Model
To address these confounders, we fit a multi-way panel fixed-effects linear regression model:
$$Y_{i, z, t} = \sum_{b \in \text{Bins}} \beta_b \cdot \mathbb{I}(T_{z,t} \in b) + \gamma \cdot \text{Precip}{z,t} + \delta \cdot \text{Sunlight}{z,t} + \alpha_i + \mu_{z \times \text{month}} + \lambda_{\text{region} \times \text{date}} + \varepsilon_{i,z,t}$$
Model Components Explained:
| Term | Function / Bias Absorbed |
|---|---|
| $\alpha_i$ (User Fixed Effect) | Absorbs time-invariant individual characteristics: baseline reporting bias, scale usage variations, personality traits, and static location attributes. |
| $\mu_{z \times \text{month}}$ (Zip-by-Month FE) | Absorbs local seasonal baselines. Identifies variation solely from weather deviations relative to what is normal for that zip code in that specific month. |
| $\lambda_{\text{region} \times \text{date}}$ (Region-by-Date FE) | Absorbs day-specific macro shocks shared across neighboring locations (e.g., national holidays, major news events, economic shifts, or widespread platform updates). |
| $\text{Precip}{z,t}, \text{Sunlight}{z,t}$ | Disentangles thermal effects from concurrent atmospheric factors. |
Inference & Standard Errors:
Weather patterns are spatially correlated across nearby zip codes and serially correlated across consecutive days. Standard errors must be clustered at the zip-code level (or two-way clustered by zip code and date). Treating individual user-day observations as independent will result in severely understated standard errors and false statistical significance.
4. Validation Strategy and Sensitivity Checks
To confirm the model isolates a causal relationship rather than spurious residual correlations, apply the following diagnostic procedures:
-
Falsification Test via Future Weather (Leads):
- Include lead temperature variables $T_{z, t+1}$ and $T_{z, t+2}$ in the model.
- Logic: Tomorrow's temperature cannot causally alter today's reported mood score. If coefficients on future weather are statistically significant, residual autocorrelation or unobserved expectation trends remain in the model.
-
Distant Location Placebo Check:
- Re-estimate the model by replacing the true local weather $T_{z,t}$ with weather from a distant, uncorrelated zip code $T_{z_{placebo}, t}$.
- Logic: The resulting estimate should be statistically indistinguishable from zero.
-
Selective Reporting Diagnostic:
- Define a binary indicator $R_{i,t} \in {0, 1}$ representing whether user $i$ logged a mood entry on day $t$. Run the fixed-effects specification using $R_{i,t}$ as the outcome.
- Action: If temperature significantly predicts the probability of reporting, apply Inverse Probability Weighting (IPW) based on historical user engagement patterns to correct for sample selection.
-
Lag Structure & Decay Analysis:
- Include lagged weather variables ($T_{z, t-1}, T_{z, t-2}$) to evaluate whether thermal stress exhibits a cumulative lag effect or rapid adaptation over time.
Common Pitfalls to Avoid
- Pooling Cross-Sections: Running an OLS model without user or local fixed effects confuses regional lifestyle differences with temperature effects.
- Over-controlling (Mediator Bias): Controlling for short-term indoor AC utilization or sleep quality if those are direct downstream mechanisms of outdoor temperature exposure.
- Ignoring Missing Data Mechanics: Assuming missing mood logs occur entirely at random ($MAR/MCAR$).