Skip to content
RED SAGSkills

Data Scientist interview questions and answers

30 questions interviewers really ask, with what a strong answer covers. Read them, then test yourself in a timed mock interview.

Start a Data Scientist mock interview

Easy questions easy

1. Explain what a p-value is to a product manager, and one common way it is misunderstood.

A strong answer covers:

  • Probability of data this extreme if there is no real effect
  • Small p-value means the result would be surprising under the null
  • Not the probability that the null is true
  • Does not measure effect size or importance
Show model answer

I would say: imagine the new feature truly makes no difference. The p-value tells us how often we would see a result at least this big just from random chance in that world. If the p-value is 0.02, results like ours would only happen about 2% of the time by luck, so we have reasonable evidence of a real effect. A common misunderstanding is reading it as "there is a 2% chance the feature does nothing" or "98% chance it works". That is not what it means. Another mistake is treating a small p-value as a big effect. With huge samples, tiny and unimportant differences can be significant. So I always report the effect size with a confidence interval alongside the p-value, and focus on whether the change matters for the business.

2. When would you report the median instead of the mean? Give a business example.

A strong answer covers:

  • Median is robust to outliers and skew
  • Mean is pulled by extreme values
  • Examples: income, order value, delivery time, house prices
  • Report both or percentiles when distribution matters
Show model answer

I use the median when the data is skewed or has outliers, because the mean gets pulled toward extreme values. For example, delivery time for a food app: most orders arrive in 30 minutes, but a few take two hours because of rain or a lost rider. The mean might say 38 minutes, which does not describe a typical order, while the median of 30 minutes does. Income, house prices and order values are similar. That said, the mean is still important when totals matter, like average revenue per user for forecasting total revenue, since total equals mean times count. Often the best answer is to show the distribution with percentiles, such as the median and the 90th percentile, because the long tail is where customer pain often hides.

3. What is the difference between correlation and causation? How would you test if a change causes an outcome?

A strong answer covers:

  • Correlation is association; causation means changing X changes Y
  • Confounders, reverse causation and chance create correlation
  • Randomised experiments are the best test
  • Observational methods when experiments are not possible
Show model answer

Correlation means two things move together. Causation means changing one actually changes the other. Correlation can appear without causation because of a confounder, a third factor that drives both, like hot weather increasing both ice cream sales and drownings. It can also come from reverse causation, where Y actually causes X, or just from chance when we look at many variables. The cleanest way to test causation is a randomised experiment, like an A/B test: randomly give the change to some users, and because the groups are similar in every other way, the difference in outcome is caused by the change. When I cannot run an experiment, I use methods like difference-in-differences or matching, and I am honest that conclusions are weaker and depend on assumptions.

4. How do you handle missing values in a dataset?

A strong answer covers:

  • First understand why data is missing
  • Options: drop, impute (mean, median, model), or flag
  • Missingness itself can be informative
  • Fit imputation on training data only
Show model answer

First I find out how much is missing and why. If a value is missing because of a tracking bug on one app version, that is a data quality issue to fix, not just fill. If it is missing for a reason, like "last purchase date" being empty for users who never bought, the missingness itself carries meaning. Then I choose. If very few rows are affected and they look random, dropping them may be fine. For numeric features I often impute the median and add a binary "was missing" flag so the model can learn from it. For categories I add an "unknown" value. Sometimes model-based imputation helps. Many tree models handle missing values directly. For modelling, I fit any imputation on the training set only, to avoid leakage, and check that results do not change much with different choices.

5. How do you present a data analysis to non-technical stakeholders?

A strong answer covers:

  • Start with the answer and recommendation
  • Use simple language and one clear chart per point
  • Show uncertainty honestly
  • Link findings to business impact and next steps
Show model answer

I start with the conclusion, not the method. For example: "Delivery delays are the main reason for the drop in repeat orders, and fixing the evening peak could recover about 4% of revenue." Then I support it with two or three simple charts, each making one point with a clear title. I avoid jargon like p-values and instead say "we are fairly confident the effect is between 2% and 6%". I am honest about limits, such as data gaps or the fact that it is a correlation, not a proven cause. I connect everything to what the audience cares about, like revenue, cost or customer experience, and end with a clear recommendation and next steps. I keep detailed methods in an appendix for anyone who wants to check the work.

6. Explain the trade-off between precision and recall, and how you would pick a threshold for a real model.

A strong answer covers:

  • Precision is the share of flagged cases that are truly positive
  • Recall is the share of real positives that get flagged
  • Raising the threshold usually raises precision and lowers recall
  • Pick the threshold from the business cost of each error type
  • Use a precision-recall curve to see the options
Show model answer

Precision asks: of everything the model flagged, how much was really positive? Recall asks: of all real positives, how many did we catch? Most models output a score, and the threshold decides what counts as a positive. If I raise the threshold, I flag fewer cases, so precision usually goes up and recall goes down. Lowering it does the opposite. There is no universally right point. I would plot the precision-recall curve and talk to the business about the cost of each mistake. For fraud review, a missed fraud might cost hundreds of dollars while a false alarm costs a few minutes of an analyst, so I would favour recall up to the team review capacity. For an email that tells customers their account is suspended, false positives are very costly, so I would favour precision. F1 is a handy summary when costs are similar.

7. What is the central limit theorem and why does it matter for everyday analysis work?

A strong answer covers:

  • Sample means are approximately normal for large samples
  • Holds even when the raw data is skewed, given finite variance
  • Justifies confidence intervals and z or t tests on averages
  • Needs larger samples for very skewed or heavy-tailed data
Show model answer

The central limit theorem says that if you take many random samples and compute the mean of each, those means form an approximately normal distribution, even when the raw data is not normal, as long as the variance is finite and the sample is reasonably large. Its spread is the standard error, sigma divided by the square root of n. This matters because most of our metrics are averages: average order value, conversion rate, time spent. The CLT is what lets us build confidence intervals and run z or t tests on them without knowing the exact shape of the data. The caveat is that very skewed or heavy-tailed data, like revenue with a few whales, needs a much larger sample before the approximation is good. In those cases I check with a bootstrap, cap extreme values, or use a transformation.

8. You receive a new, messy dataset for an analysis. What are your first steps before any modelling?

A strong answer covers:

  • Understand the source, grain and meaning of each column
  • Check row counts, duplicates and key uniqueness
  • Profile missing values, ranges and outliers
  • Check data types, units and date ranges
  • Document assumptions and confirm odd findings with data owners
Show model answer

First I find out what one row represents and where the data came from, because the grain decides how everything else is analysed. Then I check basic shape: row counts against what I expect, duplicate rows, and whether the supposed keys are really unique. Next I profile every column: data types, share of missing values, ranges, distinct values and obvious outliers such as negative ages or prices of zero. I check dates cover the period I expect and that there are no gaps or sudden jumps that suggest a pipeline change. I also look at units and currencies. Anything strange I write down and confirm with the data owner rather than guessing. Only after that do I decide how to handle missing values and outliers, and I keep the cleaning steps in code so the analysis is reproducible.

9. How do you choose the right chart to present a finding to senior leaders?

A strong answer covers:

  • Start from the one message the chart must show
  • Match the chart type to the comparison: trend, ranking, distribution, part of whole
  • Remove clutter and label directly
  • Use a headline title that states the takeaway
  • Show uncertainty or context where it matters
Show model answer

I start with the single message I want the leader to remember, then pick the chart that makes that comparison obvious. A trend over time is a line chart, a ranking across categories is a sorted bar chart, a distribution is a histogram or box plot, and I avoid pie charts unless there are only two or three parts. Then I strip clutter: no 3D, few gridlines, direct labels instead of legends, and one highlight colour for the thing that matters. The title states the takeaway, such as "Churn doubled in the basic plan after the price change", rather than "Churn by plan". I add context like a target line or last year for comparison, and show uncertainty if the numbers are estimates. Finally I check that someone can understand it in ten seconds without me explaining it.

10. Why do we split data into training, validation and test sets? How do you decide how to split?

A strong answer covers:

  • Training data fits the model parameters
  • Validation data is used for tuning and model choice
  • Test data gives a final unbiased estimate and is used once
  • Split by time for forecasting and by entity to avoid leakage
  • Cross-validation helps when data is small
Show model answer

The training set is what the model learns from. The validation set is used to compare models and tune hyperparameters, and because we make many choices with it, its score becomes slightly optimistic. The test set is kept aside and used once at the end to estimate how the model will perform on truly new data. How I split depends on how the model will be used. If it predicts the future, I split by time, training on older data and testing on newer data. If one customer has many rows, I split by customer so the same person never appears in both training and test, otherwise the model can memorise them. For small datasets I use k-fold cross-validation for tuning to get more stable estimates, but still keep a final holdout when possible.

Medium questions medium

1. Walk through how you would design an A/B test for a new checkout page.

A strong answer covers:

  • Clear hypothesis and primary metric
  • Guardrail metrics
  • Randomisation unit and power analysis for sample size and duration
  • Checks: sample ratio mismatch, novelty effect, no peeking
  • Decision rule agreed before launch
Show model answer

I start with a hypothesis: the new checkout reduces friction, so the purchase conversion rate per visitor will go up. That is my primary metric. I add guardrails like average order value, payment errors, page load time and refund rate, so a "win" does not hide damage. I randomise by user, so people see a consistent page across sessions. Then I run a power analysis using the baseline conversion, its variance and the smallest lift worth detecting to decide sample size, and I run for at least one or two full weeks to cover weekday patterns. During the test I check for sample ratio mismatch and logging problems, but I do not stop early just because the p-value looks good. Before launch, the team agrees on the decision rule, for example ship if conversion improves significantly and no guardrail worsens.

2. How would you choose a success metric for a new "recommended for you" section in a shopping app?

A strong answer covers:

  • Tie the metric to user value and business goals
  • Avoid vanity metrics like raw clicks alone
  • Primary metric plus counter or guardrail metrics
  • Metric must be sensitive and measurable in a reasonable time
  • Consider long-term effects such as cannibalisation
Show model answer

I start with the goal: help users find products they want, which should increase purchases. Clicks on the section are easy to measure but can be a vanity metric, since eye-catching items get clicks without sales. So I would choose something closer to value, like purchases or revenue per user that come from the section, or better, overall purchases per user, because the section could just steal purchases from search. That overall metric captures cannibalisation. I would add guardrails: return rate, page load time, and diversity of items shown. The metric must also be sensitive enough to move within a few weeks of testing; if overall revenue is too noisy, I might use a proxy like add-to-cart rate, after checking that it predicts revenue. Longer term, I would watch repeat visits.

3. You have 500 candidate features for a churn model. How do you decide which ones to keep?

A strong answer covers:

  • Remove leaky, constant and duplicate features first
  • Use domain knowledge
  • Model-based importance, regularisation, permutation importance
  • Validate with cross-validation, not training performance
  • Consider cost, latency and stability of features
Show model answer

First I clean up: remove features that leak the target, such as anything recorded after the churn date, plus constant, nearly empty and duplicate columns. I check pairs with very high correlation and keep the more reliable one. Domain knowledge helps me group features into themes, like usage, billing and support. Then I let a model help. With gradient boosting I look at permutation importance or SHAP values on validation data, since built-in split importance can be misleading. L1 regularisation in a logistic model is another way to shrink weak features to zero. I always judge choices by cross-validated performance, not training scores, and check the selection is stable across folds. Finally I consider practicality: features that are expensive or slow to compute in production, or hard to explain, need to earn their place.

4. A business team does not trust your credit risk model. How do you explain its predictions?

A strong answer covers:

  • Global explanations: important features, partial dependence
  • Local explanations: SHAP values for individual cases
  • Show performance and calibration on recent data
  • Check fairness and sensible behaviour with domain experts
  • Consider a simpler interpretable model if needed
Show model answer

I would explain at two levels. Globally, I show which features matter most and how they affect risk, using SHAP summary plots or partial dependence plots, for example "risk rises steadily with the number of missed payments". I check with credit experts that these patterns make sense. Locally, for individual applicants, SHAP values show which factors pushed a score up or down, which also helps with adverse action reasons customers may be owed. Trust also comes from evidence: I show performance on recent data, calibration, so a predicted 10% default rate really means about 10%, and results across segments to check fairness. I walk through real examples, including mistakes. If the gain from a complex model is small, I would consider a simpler scorecard or logistic model that is easier to explain and govern.

5. The CEO asks: "Why are customers churning?" How do you approach this?

A strong answer covers:

  • Define churn precisely and measure the trend
  • Segment by cohort, plan, channel, region
  • Look at behaviour before churn and exit reasons
  • Separate correlation from causation
  • Recommend actions and tests
Show model answer

First I define churn clearly, for example "no purchase in 60 days" or "subscription cancelled", and check how the rate has changed over time using retention curves by signup cohort. Then I segment: by plan, acquisition channel, region, device and tenure, to see where churn is concentrated. Often one segment, like users from a discount campaign, explains most of it. Next I look at behaviour before churn, such as fewer logins, support tickets or failed payments, and combine this with qualitative data like cancellation reasons and support conversations. A churn model with SHAP can show which factors predict churn, but I am careful to say these are associations, not proven causes. I finish with prioritised recommendations, such as fixing failed payment retries, and propose experiments to confirm the biggest drivers.

6. You are building a model where only 0.5% of examples are positive. How do you approach training and evaluation?

A strong answer covers:

  • Use metrics like PR-AUC, recall at a fixed precision, not accuracy
  • Keep the real class balance in validation and test sets
  • Try class weights or resampling only inside training folds
  • Tune the decision threshold to business costs
  • Check calibration if probabilities are used downstream
Show model answer

First I would make sure evaluation is honest. Accuracy is useless at 0.5% positives, so I would use PR-AUC and a business metric such as recall at the precision the operations team can handle. I would use stratified splits, or time-based ones if relevant, and keep the true class balance in validation and test. For training, I would start with a strong baseline like gradient boosting with class weights, which often works as well as resampling. If I try undersampling or SMOTE, I apply it only inside training folds to avoid leakage. Then I choose the threshold from the precision-recall curve based on the cost of a missed positive versus a false alarm. If the scores feed pricing or prioritisation, I check calibration, because weighting and resampling distort probabilities, and recalibrate with isotonic or Platt scaling if needed.

7. How would you validate a demand forecasting model before the business relies on it?

A strong answer covers:

  • Use rolling-origin backtests that respect time order
  • Compare against simple baselines such as seasonal naive
  • Pick error metrics that match the business, such as MAPE, WAPE or bias
  • Check features only use data available at forecast time
  • Review errors by segment, horizon and special periods
Show model answer

I would run a rolling-origin backtest: train on data up to a cutoff, forecast the next horizon, move the cutoff forward and repeat, so every test period is in the future relative to training. I would always compare against simple baselines like last year same week or a seasonal naive forecast, because a complex model that cannot beat them is not worth running. For metrics I would use WAPE or MAE for accuracy and check bias separately, since a forecast that is always 5% low causes stock-outs even if its error looks small. I would check every feature is available at forecast time, for example using promotions that are planned in advance but not actual sales. Finally I would break errors down by product, store, horizon and holiday periods, and share those results with planners so they know where to trust the forecast.

8. What is data leakage, how do you detect it, and how do you prevent it in a modelling project?

A strong answer covers:

  • Leakage is information in training that will not exist at prediction time
  • Signs include suspiciously high scores and a single dominant feature
  • Common causes: future data, label-derived features, preprocessing on all data, duplicate entities across splits
  • Prevent with point-in-time features, pipelines and proper splits
Show model answer

Leakage is when the model learns from information that will not be available when it makes real predictions, so offline scores look great but production results do not. Warning signs are scores that seem too good, like 0.99 AUC on a hard problem, or one feature dominating importance. I investigate those features and ask when each value becomes known. Common causes are features derived from the label, such as a refund flag in a fraud model, using future data in time series, fitting scalers or encoders on the whole dataset before splitting, and the same customer appearing in both train and test. To prevent it I build features with point-in-time logic using an as-of timestamp, put all preprocessing inside a pipeline that is fitted on training folds only, split by time or entity when needed, and finally compare offline metrics with a short shadow run in production.

9. How do you decide between a regularised linear model and a gradient boosted tree model for a tabular problem?

A strong answer covers:

  • Linear models are interpretable, stable and good with few rows or many sparse features
  • Boosted trees capture non-linearity and interactions with little feature work
  • Consider explainability, latency and maintenance needs
  • Compare both against a baseline with proper validation
Show model answer

I usually try both, because the comparison itself is informative. A regularised linear or logistic model is fast, stable, easy to explain with coefficients and works well when data is small, very wide or sparse, such as text features. It needs manual work for non-linear effects and interactions. Gradient boosted trees usually win on accuracy for medium to large tabular data because they find non-linearities and interactions automatically and handle missing values and mixed scales. The trade-offs are less transparent explanations, more tuning and a higher risk of overfitting on small data. I would also weigh the context: if a regulator needs clear reasons, or the gain from boosting is tiny, I prefer the linear model. I compare them on the same validation scheme against a simple baseline, and look at calibration and stability across time periods, not only the headline metric.

10. Walk me through how you would decide the sample size and duration of an A/B test.

A strong answer covers:

  • Choose the primary metric and its baseline and variance
  • Agree a minimum detectable effect that matters to the business
  • Set alpha and power, then compute users per group
  • Convert users to days using traffic, and cover full weekly cycles
  • Commit to the duration in advance to avoid peeking
Show model answer

I start with the primary metric and get its baseline value and variance from historical data. Then I agree a minimum detectable effect with the product team, meaning the smallest change worth acting on, not the effect we hope for. With alpha usually 0.05 and power 80%, I compute the sample size per group; for a conversion rate this is roughly 16 times p(1-p) divided by the effect squared. I divide that by the daily eligible traffic to get the number of days, then round up to full weeks so weekday and weekend behaviour are both included. If the duration is too long, I look at variance reduction such as CUPED, a more sensitive metric, or a larger effect size. Finally I write the plan down before launch, including the stopping date, so we do not peek and stop early on a lucky result.

Hard questions hard

1. An A/B test shows a significant 3% increase in conversion but a significant 2% drop in average order value. What do you do?

A strong answer covers:

  • Check validity first: SRM, bugs, novelty, duration
  • Look at the overall metric that matters, such as revenue per visitor
  • Segment to understand the mechanism
  • Consider long-term effects like margin and retention
  • Make a recommendation with trade-offs
Show model answer

First I check the test is valid: no sample ratio mismatch, no logging changes, enough duration to pass novelty effects, and the metrics were planned in advance. Then I look at what actually matters for the business, usually revenue or profit per visitor, which combines conversion and order value. A 3% rise in conversion and a 2% fall in order value is roughly a 1% revenue gain, but I would compute it directly with a confidence interval. Next I segment to understand the mechanism: maybe the new design brings in more small first-time purchases, which could be good for long-term retention, or maybe it pushes cheaper items with lower margin. I would check margin, return rate and repeat purchase rate. My recommendation would explain the trade-off clearly and might suggest a follow-up test to keep the conversion gain while protecting order value.

2. Leadership wants to know the effect of a loyalty programme that launched for everyone last year, with no experiment. How do you estimate it?

A strong answer covers:

  • State the causal question and assumptions clearly
  • Methods: difference-in-differences, synthetic control, matching, regression discontinuity, interrupted time series
  • Choose based on data available (control groups, timing, eligibility rules)
  • Robustness checks and placebo tests
  • Communicate uncertainty and limitations
Show model answer

I start by defining the question exactly: the effect of joining, or of the programme existing, on spend over what time frame. Then I look for natural comparisons. If the programme rolled out in different cities at different times, difference-in-differences comparing early and late cities works, after checking parallel pre-trends. If there was an eligibility rule, like spending above a threshold, regression discontinuity compares customers just above and below. If all customers got it at once, synthetic control or interrupted time series with a forecast of the counterfactual can help, using similar markets or products as controls. Comparing members to non-members needs matching on pre-launch behaviour, but self-selection bias remains. I run placebo tests, such as fake launch dates, and try several methods. I report a range, not one number, and state the assumptions clearly.

3. Build a daily demand forecast for 5,000 products across 200 stores. How would you approach it?

A strong answer covers:

  • Understand use: decision, horizon, granularity, cost of errors
  • Baselines: seasonal naive, moving averages
  • Global models (gradient boosting) with lag, calendar, price, promo features
  • Handle intermittent demand, new products, stockouts
  • Time-based backtesting and probabilistic forecasts
Show model answer

First I learn how the forecast is used: if it drives store replenishment, I need daily forecasts per product and store, a horizon matching lead times, and the cost of overstock versus stockouts. I build simple baselines first, like seasonal naive using the same weekday last week. Then I train one global model, often gradient boosting, across all series with features such as lagged sales, rolling averages, day of week, holidays and festivals, price, promotions and store attributes. A global model shares patterns, which helps sparse products. I treat stockouts carefully, since zero sales during a stockout are not zero demand. For new products I use similar-item features. I evaluate with rolling time-based backtests using metrics like weighted MAPE, and produce quantile forecasts because replenishment needs uncertainty, not only a point estimate.

4. Why are A/B tests tricky in a two-sided marketplace like a ride-hailing app, and how would you handle it?

A strong answer covers:

  • Interference: treatment and control share the same supply
  • User-level randomisation can be biased
  • Switchback tests by time and region, or cluster randomisation
  • Trade-off between bias and statistical power
  • Measure both sides of the market
Show model answer

In a marketplace, riders in treatment and control compete for the same drivers. If a new pricing feature makes treatment riders book more, they take drivers away from control riders, so control gets worse and the measured lift is exaggerated. This breaks the assumption that one user outcome does not depend on another group. To reduce interference, I randomise at a level where spillover is small. Switchback experiments alternate treatment and control for a whole city or zone over time windows, like 30 minutes, so the whole market is in one state at a time. Cluster randomisation by city or region also works. The trade-off is fewer independent units, so less power and wider confidence intervals; I need longer tests and careful variance estimation. I would also measure both sides: rider conversion and wait times, and driver earnings and utilisation.

5. Daily active users dropped 8% overnight. How do you investigate?

A strong answer covers:

  • Confirm the drop is real: data pipeline, tracking, definitions
  • Check external factors: holidays, outages, competitor events
  • Segment by platform, version, region, channel
  • Correlate with releases and experiments
  • Communicate findings and next steps quickly
Show model answer

First I check whether the drop is real. I look for pipeline delays, missing partitions, changes in event tracking or a new metric definition, and compare with other sources like server logs or backend orders. If the data is fine, I check the calendar and outside events: a festival, a public holiday, a payment or app store outage. Then I segment: platform, app version, country, acquisition channel, new versus returning users. A sharp drop limited to one segment usually points to the cause, like Android users on the latest release, which suggests a bug in that version, or one region, suggesting an outage or network issue. I check release notes, feature flags and experiments launched that day. I share a short update early with what we know and do not know, then the root cause and fix once confirmed.

6. Marketing wants to send a discount only to customers it will actually persuade. How would you build and validate that targeting model?

A strong answer covers:

  • The goal is uplift (treatment effect), not purchase probability
  • Needs randomised data with treated and control customers
  • Use uplift methods such as two-model, T-learner or causal forests
  • Evaluate with uplift or Qini curves on held-out randomised data
  • Confirm with a new test comparing targeting against random
Show model answer

The trap is to target people with a high purchase probability, because many of them would buy anyway and the discount just loses margin. What we want is uplift: how much the discount raises the chance of buying for each customer. To learn that we need randomised data, so I would run an experiment where a random subset gets the discount. Then I can fit uplift models, for example a T-learner with one model for treated and one for control, or a causal forest, and estimate each customer effect. Evaluation is tricky because we never see both outcomes for one person, so I use uplift or Qini curves on held-out randomised data, checking that the top-scored groups show the largest treated-minus-control difference. Finally I would run a confirmation test comparing model targeting with random targeting, measured on incremental profit after discount costs.

7. A model that looked strong offline performs much worse a month after launch. How do you investigate?

A strong answer covers:

  • Confirm the drop is real and measured correctly, given label delay
  • Check training-serving skew and pipeline bugs first
  • Compare feature and score distributions with training (data drift)
  • Check whether the relationship has changed (concept drift)
  • Look for leakage in the offline evaluation and feedback loops
Show model answer

First I confirm the drop is real: are labels complete yet, is the metric computed the same way as offline, and did the population change, for example a new market? Then I look for training-serving skew, which is the most common cause. I log the features the model actually received and compare them with what the offline pipeline would compute for the same entities; differences in units, time zones, default values or missing joins show up quickly. Next I compare feature and score distributions with training data using PSI or simple histograms to find data drift. If inputs look the same but performance fell, the relationship may have changed, which is concept drift, perhaps from a competitor or policy change. I also revisit the offline evaluation for leakage, since a too-good backtest often explains a disappointing launch, and check for feedback loops where the model changes the data it later learns from.

8. When would you use survival analysis instead of a binary churn classifier, and how would you set it up?

A strong answer covers:

  • Survival analysis models time until churn, not just whether it happens
  • Handles right-censored customers who are still active
  • Kaplan-Meier for descriptive curves, Cox or survival forests for covariates
  • Check proportional hazards and time-varying covariates
  • Evaluate with concordance index and calibration over time
Show model answer

A binary classifier answers "will this customer churn in the next 30 days", which needs a fixed window and throws away information about when churn happens. Survival analysis models time to churn and uses customers who are still active as right-censored observations, rather than dropping them or treating them as non-churners. I would start with Kaplan-Meier curves by plan or acquisition channel to describe retention. For prediction I would use a Cox proportional hazards model for interpretable hazard ratios, or a survival forest or gradient boosted survival model if effects are non-linear. I would check the proportional hazards assumption, because effects like a discount often fade over time, and handle time-varying covariates such as recent usage carefully to avoid using future data. Evaluation uses the concordance index for ranking and calibration of predicted survival at key horizons like 90 days.

9. You must estimate the effect of a feature that users chose to adopt, using propensity score methods. What can go wrong and how do you guard against it?

A strong answer covers:

  • Unmeasured confounders are not fixed by propensity scores
  • Only pre-treatment covariates should be used, not post-treatment ones
  • Check overlap and trim extreme scores
  • Check covariate balance after matching or weighting
  • Run sensitivity analysis and negative controls
Show model answer

Propensity methods only adjust for confounders we measure, so the biggest risk is unmeasured ones like motivation, which drives both adoption and retention. I would list likely confounders with the product team and include pre-treatment behaviour such as usage in the weeks before adoption, which is a strong proxy for motivation. I must avoid post-treatment variables, because adjusting for things the feature itself changes removes part of the real effect or adds bias. Next I check overlap: if many adopters have propensities near one, there are no comparable non-adopters, so I trim and state the population the estimate applies to. After matching or weighting I check balance with standardised mean differences below about 0.1. Finally I run a sensitivity analysis to see how strong a hidden confounder would need to be to remove the effect, and use a negative control outcome the feature should not affect.

10. The business wants to know how demand responds to price for thousands of products. How would you estimate price elasticity?

A strong answer covers:

  • Observational price changes are confounded by demand and promotions
  • Use experiments or natural variation such as staggered price changes
  • Log-log models give elasticity as a coefficient
  • Pool across products with hierarchical models for sparse items
  • Control for seasonality, competitors, stock-outs and cannibalisation
Show model answer

The core problem is confounding: prices are often cut when demand is low or raised during peaks, so a naive regression of sales on price gives the wrong sign or size. The best data comes from randomised price tests across stores or time, and the next best from natural variation like staggered price changes or cost-driven changes unrelated to demand. I would model log units against log price, so the coefficient is the elasticity, with controls for seasonality, promotions, competitor prices and holidays. Stock-outs must be handled, because zero sales when out of stock is not low demand. With thousands of products, many have little price variation, so I would use a hierarchical model that shrinks each product towards its category average. I would also check cross-effects, since cutting one price can cannibalise similar products, and validate predictions on held-out price changes before using them for pricing.