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.