Skip to content

Cookies on Jobverse

We use cookies that are needed to sign you in and keep the site working. With your permission we’d also use an analytics cookie to count job views, and Google advertising cookies to show ads. The site works the same whatever you choose. Read the Cookie Policy.

Jobverse
Sign in

Data Scientist Top 100 Interview Questions

100 data scientist interview questions with structured answers, comparison tables, flow diagrams, worked calculations and runnable Python and SQL. Covers statistics, probability, A/B testing, causal inference, product metrics, SQL analytics, exploratory analysis, modeling for decisions and communication, from the basics to real business scenarios.

100 questions

Questions 41-60 of 100

  1. Q41.What is selection bias, and how does survivorship bias distort analyses?

    Selection bias occurs when the data you analyze is not representative of the population you want to draw conclusions about, because of how cases entered the dataset. Survivorship bias is a common form: analyzing only cases that made it through some filter.

    Examples in business data:

    • Survivorship: studying the features used by long-term customers, then concluding those features cause retention, while ignoring churned customers who used them too.
    • Self-selection: users who opt into a beta are more engaged, so the beta looks better than it would for everyone.
    • Response bias: surveys answered mainly by very happy or very unhappy customers.
    • Filtering: analyzing only completed orders, which hides problems that stopped orders from completing.

    How to avoid it:

    1. Define the population first, and check how each record got into the data.
    2. Compare the characteristics of included and excluded cases.
    3. Start cohorts at a shared starting point, such as signup, and follow everyone, including those who leave.
    4. Use randomization when you need to compare treatments.

    Collecting more data from the same biased process does not reduce selection bias; it only makes the wrong answer more precise.

  2. Q42.How does difference-in-differences estimate a causal effect?

    It compares the change over time in a group that received a treatment with the change over the same period in a group that did not. Subtracting the control group's change removes trends that affect both groups, such as seasonality.

    effect = (treated_after − treated_before) − (control_after − control_before)

    The key assumption is parallel trends: without the treatment, both groups would have changed by the same amount. Check it by plotting several periods before the treatment; diverging pre-trends make the estimate unreliable.

    Practical choices:

    • Scale: decide in advance whether trends should be parallel in absolute terms or in percentages, since the two can give different answers.
    • Several periods: use regression with group and time effects when there are many periods or groups.
    • Timing: watch for other changes that hit only one group at the same time.
    • Anticipation: if behavior changed before the official start, because the change was announced, the estimate is biased.

    Example

    A delivery fee cut launches in one city, with a similar city as the control. Weekly orders are counted for the month before and after.

    1. Treated city: 1,000 before and 1,150 after, a change of 150.
    2. Control city: 800 before and 840 after, a change of 40.
    3. Effect in absolute terms: 150 − 40 = 110 extra orders per week.
    4. If trends are assumed parallel in percentages instead, the control's 5% growth implies 50 expected extra orders, so the effect becomes 150 − 50 = 100. The scale choice must be justified before analysis.
  3. Q43.How does matching on a propensity score work, and what are its limits?

    A propensity score is the estimated probability that a unit receives the treatment, given its observed characteristics. Matching or weighting on that score creates a comparison group whose observed characteristics resemble the treated group, which mimics a randomized comparison for those variables.

    1. Fit a model predicting treatment from pre-treatment variables, such as usage, tenure and plan.
    2. Match each treated unit with untreated units that have similar scores, or weight units by the inverse of their probability of the treatment they actually received.
    3. Check balance: after matching, the distributions of each variable should be similar between groups.
    4. Compare outcomes between the matched groups.

    Limits:

    • It only balances observed variables; an unmeasured confounder, such as motivation, still biases the result.
    • It needs overlap: if some treated units have no comparable untreated units, the estimate does not apply to them.
    • Extreme weights from scores near 0 or 1 make estimates unstable; trimming or capping helps.
    • Variables measured after treatment must never go into the model.

    Use it when an experiment is impossible, and present it with clear caveats about unmeasured confounding.

  4. Q44.What is an instrumental variable, and when can you use one?

    An instrumental variable is something that shifts the chance of receiving a treatment but affects the outcome only through that treatment. It isolates part of the treatment's variation that is free of confounding, even when confounders are unmeasured.

    flowchart LR
      Z["Random email reminder"] --> T["Uses the new feature"]
      T --> Y["Retention"]
      U["Unmeasured motivation"] --> T
      U --> Y

    Requirements for a valid instrument:

    1. Relevance: it must noticeably change treatment uptake; weak instruments give very noisy and biased estimates.
    2. Exclusion: it affects the outcome only through the treatment, which must be argued, since it cannot be fully tested.
    3. Independence: it is unrelated to the confounders, which randomization of the instrument guarantees.

    Common uses:

    • Encouragement designs: randomly encouraging some users to try a feature, when the feature itself cannot be forced.
    • Non-compliance in experiments: estimating the effect on those who actually used the treatment, not just those offered it.

    The estimate applies to units whose treatment changed because of the instrument, which may differ from the whole population.

  5. Q45.How does a regression discontinuity design estimate a causal effect?

    When treatment is assigned by a cutoff on a continuous score, units just above and just below the cutoff are nearly identical except for the treatment. Comparing them estimates the treatment's effect at the cutoff.

    Typical situations:

    • Loyalty tiers granted at a points threshold.
    • Free shipping above an order value.
    • Credit decisions based on a score cutoff.

    How to do it well:

    1. Plot the outcome against the score, and look for a jump at the cutoff.
    2. Fit trends on each side within a narrow window, rather than comparing raw averages.
    3. Test several window widths to check the result is stable.
    4. Check for manipulation: if units can push themselves just over the cutoff, the groups are no longer comparable, which shows up as a bunching of units just above it.

    Limits: the effect is local to units near the cutoff, and it needs many observations close to the threshold.

    Example

    Customers reaching 10,000 loyalty points enter a gold tier with extra benefits.

    1. Customers with 9,800 to 9,999 points spend an average of 5,200 rupees next quarter.
    2. Customers with 10,000 to 10,199 points spend 5,650 rupees.
    3. Fitted trends on both sides confirm a jump of about 450 rupees at the cutoff.
    4. The gold tier raises next-quarter spending by about 450 rupees for customers near 10,000 points; customers far above the cutoff may respond differently.
  6. Q46.How do you estimate a feature's impact when no experiment was run?

    Choose a quasi-experimental method based on how the feature was rolled out and what comparison data exists. Every method relies on an assumption that should be stated and checked.

    Difference-in-differencesInterrupted time seriesSynthetic controlMatching
    Compares the change in exposed and unexposed groupsCompares the trend after launch with the trend before itBuilds a weighted mix of unexposed units that tracks the exposed unit before launchPairs exposed users with similar unexposed users
    Needs a comparable group and parallel trendsNeeds a long, stable history and no other change at launch timeNeeds many candidate control units and a long pre-periodNeeds rich pre-launch data and no unmeasured confounders
    Best for a launch in some regions onlyBest for a launch to everyone at onceBest for one exposed region or marketBest for opt-in features

    Making the result credible:

    • Run placebo tests, such as pretending the launch happened earlier, which should show no effect.
    • Use more than one method when possible, and check whether they agree.
    • Report a range of estimates, with the assumptions behind each.

    For future launches, recommend a staged rollout with random order, which makes the next analysis far easier.

  7. Q47.How can a change in segment mix move an overall metric when no segment changed?

    An overall rate is a weighted average of segment rates. If the share of traffic in each segment shifts, the overall rate moves even when every segment performs exactly as before. In extreme cases, every segment can improve while the overall rate falls.

    Where mix shift appears:

    • More traffic from mobile, where conversion is naturally lower.
    • A marketing campaign bringing many new users, who convert less than returning ones.
    • Growth in a low-price region, lowering the average order value.

    How to diagnose it:

    1. Break the metric down by the main segments, such as device, channel, region and user tenure.
    2. Separate the change into a rate effect, from changes within segments, and a mix effect, from changes in segment shares.
    3. Report both, so the team does not chase a problem that does not exist, or miss one hidden by a favorable mix.

    Example

    Mobile converts at 2% and desktop at 6%, in both periods.

    1. Period 1 has 50% mobile traffic: 0.5 × 2% + 0.5 × 6% = 4% overall.
    2. Period 2 has 75% mobile traffic: 0.75 × 2% + 0.25 × 6% = 3% overall.
    3. Overall conversion fell by a full percentage point, entirely from mix.
    4. The right response is about acquisition and mobile experience strategy, not a hunt for a broken checkout.
  8. Q48.How do you find out whether a treatment effect differs across user segments?

    Estimate the effect within each segment, test whether the differences between segments are larger than chance would produce, and treat surprising segment results as hypotheses to confirm.

    1. Pre-specify a few segments with a reason to expect differences, such as new versus returning users or platform.
    2. Test the interaction, meaning the difference between segment effects, not whether each segment's effect is significant on its own. One significant segment and one non-significant segment do not prove the effects differ.
    3. Correct for multiple comparisons when many segments are examined.
    4. Check sample sizes, since small segments produce noisy, extreme estimates.
    5. Confirm with a new experiment targeted at the segment before acting on an unexpected finding.

    Why it matters:

    • A feature that helps new users but annoys experienced users may deserve a targeted launch.
    • Averages can hide harm to an important minority, such as users with accessibility needs.

    Interview tip: mentioning that segment searches after the fact are a classic source of false discoveries signals rigor without dismissing segment analysis entirely.

  9. Q49.How do long-term holdout groups measure the cumulative impact of many launches?

    A long-term holdout keeps a small random share of users on the old experience for months, while everyone else receives each new launch. Comparing the two groups measures the combined, lasting effect of all launches, which individual short experiments cannot.

    flowchart LR
      A["All eligible users"] --> B["95% receive every launch"]
      A --> C["5% long-term holdout"]
      B --> D["Compare after several months"]
      C --> D
      D --> E["Cumulative lasting impact"]

    What it reveals:

    • Whether short-term gains persist, fade or reverse over time.
    • Whether individual wins add up, or overlap and cancel each other out.
    • Long-term effects on retention and revenue that short tests are too brief to measure.

    Costs and cautions:

    • Holdout users miss improvements, which has a business cost and sometimes a fairness cost.
    • Keep the holdout small, stable and randomly chosen, and refresh it periodically.
    • Some changes, such as security fixes or legal requirements, must reach everyone and cannot be held back.
  10. Q50.When should you not run an A/B test?

    A/B testing is powerful but not always appropriate. Skip it, or choose a different method, when the test cannot produce a trustworthy answer or the answer would not change the decision.

    When an A/B test is the wrong tool:

    • Too little traffic: the required sample would take months; use qualitative research, a bolder change or a quasi-experiment.
    • Required changes: legal, security and accessibility fixes must ship regardless of metrics.
    • Strong interference: marketplaces and social features where users affect each other need cluster designs instead.
    • Long-term outcomes: effects that take a year to appear, such as brand trust, need holdouts or other evidence.
    • Ethical limits: withholding something clearly beneficial, or exposing users to harm, is not acceptable.
    • One-time decisions: a single big launch, such as a rebrand, offers no stable comparison and nothing to repeat.
    • No decision depends on it: if the team will ship regardless, the test only spends time.

    What to do instead: user research, staged rollouts with careful monitoring, before-and-after analysis with comparison groups, or simulations based on past data. State clearly how much uncertainty each alternative leaves.

  11. Q51.How do you define a north star metric and the input metrics that drive it?

    A north star metric captures the core value customers get from the product, in a form that predicts long-term business success. Input metrics are the few levers that teams can move directly, which together drive the north star.

    flowchart TD
      A["North star: orders delivered on time per week"] --> B["Active customers"]
      A --> C["Orders per active customer"]
      A --> D["On-time delivery rate"]
      B --> E["New customer activation"]
      B --> F["Returning customer retention"]
      C --> G["Repeat ordering features"]
      D --> H["Delivery partner availability"]

    What makes a good north star:

    • It reflects value delivered to customers, not just activity or revenue alone.
    • It moves within weeks, so teams can see the impact of their work.
    • It is hard to game: raising it should require genuinely helping customers.

    Using input metrics:

    1. Break the north star into a few multiplicative or additive components.
    2. Assign each team the inputs it can influence.
    3. Pair each input with guardrails, such as complaint rates, so teams do not push one number at the expense of experience.
    4. Revisit the tree when the strategy changes, since a metric that fit early growth may not fit a mature product.
  12. Q52.A key business metric dropped sharply yesterday. How do you investigate?

    Work from the cheapest explanations to the most expensive: first confirm the drop is real, then find where it is concentrated, then find what changed at that time.

    flowchart TD
      A["Metric dropped"] --> B{"Data issue? Logging, pipeline delay, definition change"}
      B -->|Yes| C["Fix the data and annotate the dashboard"]
      B -->|No| D["Split by segment: platform, region, channel, user type"]
      D --> E["Locate where the drop is concentrated"]
      E --> F["Match against changes: releases, campaigns, outages, competitors"]
      F --> G["Confirm the cause and size its impact"]
    1. Check the data: compare with a second source, look for missing partitions, and check whether the metric definition or tracking changed.
    2. Check the calendar: holidays, paydays, weather and seasonality often explain sharp moves.
    3. Decompose: split the metric into components, such as traffic times conversion, and by segment, to find where the change lives.
    4. Correlate with events: look at releases, experiments, marketing changes, pricing and outages around the start time.
    5. Communicate early: share what you have ruled out, with an estimate of when the cause will be confirmed.

    Interview tip: interviewers value a structured answer that starts with "is the data right?" before diving into business explanations.

  13. Q53.How do you build a retention cohort table in SQL?

    Group users by when they started, then count how many of each cohort are active in each later period, divided by the cohort's size. The result is a table with one row per cohort and period, which shows whether retention is improving for newer cohorts.

    1. Define the cohort: usually the week or month of signup or first purchase.
    2. Define activity: a meaningful action, such as an order, not just an app open.
    3. Compute the period index: the number of periods since the cohort start.
    4. Divide by the full cohort size, including users who never returned, which is why the cohort size is counted separately from activity.

    Reading the table:

    • Compare the same period across cohorts to see whether product changes improved retention.
    • Look for the curve flattening, which shows the share of users who become long-term.
    • Recent cohorts have fewer observed periods; do not treat missing cells as zero retention.

    Example

    Two weekly cohorts: three users signed up in week 0 and two in week 1.

    WITH users(user_id, signup_week) AS (
        VALUES (1, 0), (2, 0), (3, 0), (4, 1), (5, 1)
    ), activity(user_id, week) AS (
        VALUES (1, 0), (1, 1), (1, 2), (2, 0), (2, 2), (3, 0), (4, 1), (4, 2), (5, 1)
    ), cohort_size AS (
        SELECT signup_week, COUNT(*) AS users FROM users GROUP BY signup_week
    )
    SELECT u.signup_week,
           a.week - u.signup_week AS weeks_since_signup,
           COUNT(DISTINCT a.user_id) AS active_users,
           ROUND(100.0 * COUNT(DISTINCT a.user_id) / c.users, 1) AS retention_pct
    FROM users u
    JOIN activity a ON a.user_id = u.user_id
    JOIN cohort_size c ON c.signup_week = u.signup_week
    GROUP BY u.signup_week, weeks_since_signup, c.users
    ORDER BY u.signup_week, weeks_since_signup;
    -- Expected rows: (0, 0, 3, 100.0), (0, 1, 1, 33.3), (0, 2, 2, 66.7), (1, 0, 2, 100.0), (1, 1, 1, 50.0)
  14. Q54.How do you compute funnel conversion between ordered steps in SQL?

    Find the first time each user reached each step, then count users who reached every step in order. Counting step events independently overstates the funnel, because users can trigger later steps without the earlier ones or in the wrong order.

    1. One row per user: use conditional aggregation, taking the minimum timestamp per step.
    2. Enforce order: count a step only if its time is after the previous step's time.
    3. Compute step rates: divide each step's count by the previous step's count, and the final step by the first for overall conversion.

    Decisions to state explicitly:

    • Time window: for example, purchase within seven days of the first view.
    • Repeated attempts: whether users who abandon and return count once.
    • Entry definition: which users enter the funnel, such as visitors from a specific campaign.

    Comparing funnels across segments, such as device or channel, usually shows exactly which step is the bottleneck.

    Example

    User 4 added to cart before viewing, so that user is not counted past the first step.

    WITH events(user_id, event, ts) AS (
        VALUES (1, 'view', 1), (1, 'cart', 2), (1, 'purchase', 5),
               (2, 'view', 1), (2, 'cart', 3),
               (3, 'view', 2),
               (4, 'cart', 1), (4, 'view', 2),
               (5, 'view', 1), (5, 'cart', 2), (5, 'purchase', 3)
    ), firsts AS (
        SELECT user_id,
               MIN(CASE WHEN event = 'view' THEN ts END) AS viewed,
               MIN(CASE WHEN event = 'cart' THEN ts END) AS carted,
               MIN(CASE WHEN event = 'purchase' THEN ts END) AS bought
        FROM events
        GROUP BY user_id
    )
    SELECT COUNT(viewed) AS viewers,
           SUM(carted > viewed) AS carted,
           SUM(bought > carted AND carted > viewed) AS purchased,
           ROUND(100.0 * SUM(carted > viewed) / COUNT(viewed), 1) AS view_to_cart_pct,
           ROUND(100.0 * SUM(bought > carted AND carted > viewed) / SUM(carted > viewed), 1) AS cart_to_purchase_pct
    FROM firsts;
    -- Expected rows: (5, 3, 2, 60.0, 66.7)
  15. Q55.How do you calculate daily active users, monthly active users and stickiness?

    Daily active users count distinct users with a qualifying action each day; monthly active users count distinct users over the month. Stickiness divides the average daily count by the monthly count, showing what share of the month's users come back on a typical day.

    • Define "active" carefully: a meaningful action, such as viewing content or placing an order, not a background app refresh.
    • Count distinct users per day, then average those counts across the days of the period.
    • Include zero days: join to a calendar table, so a day with no activity counts as zero rather than disappearing from the average.
    • Interpretation: stickiness of 50% means the average user is active about 15 days a month; 10% means about 3 days.

    Cautions:

    • Stickiness can rise because monthly users fall, for example when casual users leave, so always show both counts.
    • Compare stickiness only between products with similar natural usage frequency, since a tax app and a messaging app should differ.

    Example

    Over a seven-day window, four distinct users are active, and the average day has 1.57 active users.

    WITH activity(user_id, day) AS (
        VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7),
               (2, 1), (2, 4), (3, 7), (4, 2), (4, 2)
    ), daily AS (
        SELECT day, COUNT(DISTINCT user_id) AS dau FROM activity GROUP BY day
    )
    SELECT ROUND(AVG(dau), 2) AS avg_dau,
           (SELECT COUNT(DISTINCT user_id) FROM activity) AS active_in_window,
           ROUND(100.0 * AVG(dau) / (SELECT COUNT(DISTINCT user_id) FROM activity), 1) AS stickiness_pct
    FROM daily;
    -- Expected rows: (1.57, 4, 39.3)
  16. Q56.How do you calculate a median in SQL when there is no built-in median function?

    Number the rows in sorted order with a window function, count the rows, then average the middle one or two values. The same idea extends to any percentile and to medians per group.

    1. Rank: ROW_NUMBER() OVER (ORDER BY value) gives each row its position.
    2. Count: COUNT(*) OVER () gives the total in the same query.
    3. Pick the middle: positions (n + 1) / 2 and (n + 2) / 2, using integer division, are the same row for an odd count and the two middle rows for an even count.
    4. Average them, which handles both cases.

    Variations:

    • Per group: add PARTITION BY group_column to both window functions and group the final average by that column.
    • Other percentiles: pick the row at position CEIL(p × n) for a simple nearest-rank percentile.
    • Large data: many analytical databases provide exact or approximate percentile functions, which are faster; approximate versions trade a little accuracy for speed.

    Medians are more useful than means for skewed values such as order amounts and delivery times.

    Example

    Six orders give a median of 107.5, the average of the third and fourth values.

    WITH orders(order_id, amount) AS (
        VALUES (1, 120), (2, 80), (3, 300), (4, 95), (5, 150), (6, 60)
    ), ranked AS (
        SELECT amount,
               ROW_NUMBER() OVER (ORDER BY amount) AS rn,
               COUNT(*) OVER () AS n
        FROM orders
    )
    SELECT AVG(amount) AS median_amount
    FROM ranked
    WHERE rn IN ((n + 1) / 2, (n + 2) / 2);
    -- Expected rows: (107.5)
  17. Q57.How do you calculate week-over-week growth in SQL?

    Use the LAG window function to bring the previous period's value onto the current row, then compute the percentage change. Ordering the window by the period makes the comparison explicit and avoids a self-join.

    • Formula: (current − previous) / previous × 100.
    • Division by zero: wrap the denominator in NULLIF(previous, 0), so a zero previous value gives a null instead of an error.
    • First period: has no previous value, so the growth is null, which is correct.
    • Gaps: if a week has no rows, LAG compares with the last week present, not the actual previous week; join to a calendar of weeks first.

    Analysis habits:

    • Compare with the same week last year as well, since week-over-week changes are dominated by seasonality.
    • Watch for incomplete current weeks, which always look like a decline.
    • Growth rates of small numbers swing wildly, so show the absolute values next to the percentages.

    Example

    Weekly revenue grows 10%, falls 10%, then grows 20%.

    WITH weekly(week, revenue) AS (
        VALUES (1, 1000), (2, 1100), (3, 990), (4, 1188)
    )
    SELECT week,
           revenue,
           LAG(revenue) OVER (ORDER BY week) AS previous,
           ROUND(100.0 * (revenue - LAG(revenue) OVER (ORDER BY week))
                 / NULLIF(LAG(revenue) OVER (ORDER BY week), 0), 1) AS growth_pct
    FROM weekly
    ORDER BY week;
    -- Expected rows: (1, 1000, None, None), (2, 1100, 1000, 10.0), (3, 990, 1100, -10.0), (4, 1188, 990, 20.0)
  18. Q58.How do you attribute each conversion to a user's first marketing touch in SQL?

    Join each conversion to the user's marketing touches that happened before it, rank those touches by time, and keep the first. Touches after the conversion must be excluded, and conversions with no prior touch should be kept as unattributed rather than silently dropped.

    1. Join on user and time: touch_time <= conversion_time.
    2. Use a left join, so conversions without any qualifying touch remain.
    3. Rank: ROW_NUMBER() OVER (PARTITION BY conversion ORDER BY touch_time) and keep rank 1.
    4. Aggregate conversions and revenue by channel.

    Limits of first-touch attribution:

    • It credits awareness channels and ignores everything that happened later.
    • Last-touch attribution has the opposite bias, favoring channels close to purchase.
    • Neither shows causal impact; channels may get credit for users who would have converted anyway.

    Use attribution for directional reporting, and use holdout experiments, such as pausing a channel in some regions, to measure what each channel actually adds.

    Example

    User 3 converted before any recorded touch, so that conversion is reported as unattributed.

    WITH touches(user_id, channel, ts) AS (
        VALUES (1, 'search', 1), (1, 'email', 3), (2, 'social', 2), (2, 'search', 4), (3, 'email', 1)
    ), conversions(user_id, ts, revenue) AS (
        VALUES (1, 5, 500), (2, 3, 300), (3, 0, 200)
    ), ranked AS (
        SELECT c.user_id,
               c.revenue,
               COALESCE(t.channel, 'unattributed') AS channel,
               ROW_NUMBER() OVER (PARTITION BY c.user_id ORDER BY t.ts) AS rn
        FROM conversions c
        LEFT JOIN touches t ON t.user_id = c.user_id AND t.ts <= c.ts
    )
    SELECT channel, COUNT(*) AS conversions, SUM(revenue) AS revenue
    FROM ranked
    WHERE rn = 1
    GROUP BY channel
    ORDER BY revenue DESC;
    -- Expected rows: ('search', 1, 500), ('social', 1, 300), ('unattributed', 1, 200)
  19. Q59.How do you approach exploratory data analysis on an unfamiliar dataset?

    Start by understanding what each row represents and how the data was produced, then check quality, then explore distributions and relationships with specific questions in mind.

    flowchart LR
      A["Grain: what is one row?"] --> B["Source and logging rules"]
      B --> C["Quality: missing, duplicates, ranges"]
      C --> D["Single-variable distributions"]
      D --> E["Relationships and segments"]
      E --> F["Questions and hypotheses to test"]
    1. Grain and keys: confirm what one row means and whether the key is unique.
    2. Coverage: check the time range, row counts per day and any gaps.
    3. Quality: count missing values, duplicates, impossible values and sudden shifts in distributions.
    4. Distributions: look at histograms and percentiles for numbers, and frequency tables for categories.
    5. Relationships: plot key variables against each other and against time, split by important segments.
    6. Reconcile: compare totals with a trusted source, such as finance reports.

    Write down findings and open questions as you go. The most valuable output of exploration is often a list of data problems and a sharper question for the real analysis.

  20. Q60.How do you decide whether data is missing completely at random, at random or not at random?

    The reason data is missing decides which fixes are safe. You cannot prove the mechanism from the data alone, but you can gather evidence by comparing rows with and without the missing value.

    Missing completely at randomMissing at randomMissing not at random
    Missingness is unrelated to anything, observed or notMissingness depends on other observed variablesMissingness depends on the missing value itself
    A sensor fails randomly for a few minutesOlder app versions do not log screen timeHigh earners skip the income question
    Dropping rows loses precision but not accuracyModel or impute using the related variablesNo simple fix; needs extra data or sensitivity analysis

    How to gather evidence:

    • Compare the observed characteristics of rows with and without the value; big differences rule out completely random missingness.
    • Check how and when the data is collected, since logging rules usually explain missingness better than statistics.
    • Track whether missingness changed over time, which often signals a pipeline change.

    Good practice: report how much data is missing, add a missing indicator when modeling, and show how conclusions change under different assumptions.