PracHub
QuestionsLearningGuidesInterview Prep
|Home/Statistics & Math/WeRide

Test Whether Two Samples Come From the Same Distribution

Last updated: Jun 15, 2026

Quick Overview

Compare two samples from continuous, categorical, or multivariate data using visual diagnostics, parametric and nonparametric tests, effect sizes, multiple-testing control, clustering-aware uncertainty, sample-size imbalance handling, and sampling methods for product evaluation.

  • medium
  • WeRide
  • Statistics & Math
  • Data Scientist

Test Whether Two Samples Come From the Same Distribution

Company: WeRide

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Technical Screen

##### Question You have two datasets, sample A and sample B. They might come from two versions of a system, two cities, or two periods of autonomous-driving operations. The variable of interest may be continuous, skewed, heavy-tailed, or categorical, and the two sample sizes may be very different. 1. **How would you test whether the two samples come from the same underlying distribution?** Discuss: - continuous versus categorical variables; - univariate versus multivariate comparisons; - parametric versus nonparametric options, and the assumptions each common test makes; - visual diagnostics, effect sizes, and how you interpret **statistical** significance versus **practical** significance; - multiple-testing issues when you compare many features; - what to do when the two sample sizes are very different. 2. **What sampling methods do you know, and when is each appropriate** for data collection or offline evaluation? Cover at least simple random, stratified, cluster, systematic, and weighted/importance sampling, plus any others you consider relevant (e.g., multistage, reservoir, convenience), and say which you would prefer for product evaluation and why.

Quick Answer: Compare two samples from continuous, categorical, or multivariate data using visual diagnostics, parametric and nonparametric tests, effect sizes, multiple-testing control, clustering-aware uncertainty, sample-size imbalance handling, and sampling methods for product evaluation.

Related Interview Questions

  • Test whether two distributions differ - WeRide (medium)
|Home/Statistics & Math/WeRide

Test Whether Two Samples Come From the Same Distribution

WeRide logo
WeRide
Jan 4, 2025, 12:00 AM
mediumData ScientistTechnical ScreenStatistics & Math
3
0

You have two datasets, sample A and sample B. They might come from two versions of a system, two cities, or two periods of autonomous-driving operations. The variable of interest may be continuous, skewed, heavy-tailed, or categorical, and the two sample sizes may be very different.

Constraints & Assumptions

  • Clarify whether the goal is comparing means, proportions, full univariate distributions, or multivariate joint distributions.
  • Pair statistical tests with effect sizes and practical significance.
  • Account for multiple testing, dependence, clustering, and sample-size imbalance.
  • Discuss sampling methods for data collection and offline evaluation.

Clarifying Questions to Ask Guidance

  • What decision will be made from the comparison?
  • Are observations independent, or are they clustered by user, vehicle, route, city, or time?
  • Are A and B intended to represent the same target population?
  • Are we comparing one variable or many features?
  • Is the concern drift, treatment impact, data quality, or evaluation sampling?

Part 1 - Test Whether Two Samples Match

How would you test whether the two samples come from the same underlying distribution?

What This Part Should Cover Guidance

  • Visual diagnostics for continuous, categorical, and multivariate data.
  • Parametric tests for means or variances when assumptions hold.
  • Nonparametric tests for full distribution differences.
  • Categorical tests and multivariate drift tests.
  • Permutation tests as a flexible option.

Part 2 - Interpret Significance And Handle Practical Issues

How would you interpret statistical significance versus practical significance, multiple testing, dependence, and very different sample sizes?

What This Part Should Cover Guidance

  • Effect sizes, confidence intervals, business thresholds, and tail differences.
  • Bonferroni or FDR correction for many features.
  • Clustered bootstrap or mixed models when observations are not independent.
  • Weighting, subsampling, or target-population checks for size imbalance.

Part 3 - Discuss Sampling Methods

What sampling methods do you know, and when is each appropriate?

What This Part Should Cover Guidance

  • Simple random, stratified, cluster, systematic, weighted/importance, multistage, reservoir, and convenience sampling.
  • Which methods are preferred for product or offline evaluation and why.

What a Strong Answer Covers Guidance

  • Does not claim one universal test solves every distribution-comparison problem.
  • Chooses tests based on variable type, dimensionality, and the question being asked.
  • Reports practical impact, not only p-values.
  • Explains sampling design and target-population representation.

Follow-up Questions Guidance

  • Why can a t-test miss distribution differences?
  • When would KS be a poor choice?
  • How would you compare high-dimensional data?
  • What if one sample is rush-hour trips and the other is all-day trips?
  • How would you sample rare safety-critical events?
Loading comments...

Browse More Questions

More Statistics & Math•More WeRide•More Data Scientist•WeRide Data Scientist•WeRide Statistics & Math•Data Scientist Statistics & Math

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.