← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
Apr 2026Remote

Summary

Meta data scientist technical screen, basically one big SQL question that took up the whole session. The problem was a staggered-adoption diff-in-diff setup and it had enough moving parts that I was sweating by the end.

Questions Asked (1)

Q1

Given a schema with sites, employees, shuttle service adoption dates, and daily participation records, write SQL to build an individual-day panel for a staggered-adoption difference-in-differences analysis. The output needs employee_id, site_id, date, participated, the site-level adoption date, a treated indicator (1 if on or after adoption date, else 0, with never-treated sites getting NULL adoption and 0), event_time in days relative to adoption, and a post binary. Then also produce a weekly site-level aggregation with average participation rate, correctly handling never-treated sites.

A/B Testing & ExperimentationData ModelingProduct Analytics & Metrics
Author's notes

This wrecked me a little.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and assumptions, then build the individual-day panel by joining daily participation with site adoption dates, computing treatment and event-time indicators. Next, aggregate to weekly site-level averages, ensuring never-treated sites are handled correctly (e.g., excluded from event-time plots or assigned a null event time). Finally, validate the panel structure and discuss how it supports a staggered DiD analysis.

Pro tip: Explicitly state how you handle never-treated sites in the weekly aggregation—whether you exclude them from event-time plots or include them as a separate 'never-treated' group—and mention that you would check for balanced panels and pre-trends.

1. Clarify schema and assumptions

Confirm table structures, date ranges, and definitions (e.g., adoption date is when shuttle service becomes available at the site). Assume daily participation is binary (1 if participated, 0 otherwise).

2. Build individual-day panel

Join daily participation records with site adoption dates. Compute treated = 1 if date >= adoption_date else 0, with never-treated sites having adoption_date NULL and treated = 0. Compute event_time = date - adoption_date (NULL for never-treated) and post = 1 if event_time >= 0 else 0.

3. Aggregate to weekly site-level

Group by site_id and week (e.g., date_trunc('week', date)). Compute average participation rate per site-week. For never-treated sites, either exclude from event-time analysis or include with a null event_time, but ensure the aggregation correctly reflects their participation.

4. Validate and finalize

Check for missing dates, ensure balanced panels if needed, and verify that treated and event_time are correctly computed. Discuss how the output supports staggered DiD (e.g., using event-study plots or regression with fixed effects).

Key Points to Mention

  • Handling of never-treated sites: adoption_date NULL, treated = 0, event_time NULL, and how they are included/excluded in weekly aggregation.
  • Definition of treated indicator: 1 if date >= adoption_date, else 0; for never-treated, always 0.
  • Event time calculation: date - adoption_date in days; for never-treated, NULL.
  • Post indicator: 1 if event_time >= 0, else 0; for never-treated, 0.
  • Weekly aggregation: average participation rate per site per week, ensuring correct handling of never-treated sites (e.g., separate group or exclusion).
  • Staggered DiD considerations: need for event-study plots, pre-trend checks, and potential use of two-way fixed effects or newer estimators.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.