How would you identify a sample's distribution, generalize it to the population, and build a confidence interval?
Role: Data Scientist
Category: Statistics & Math
Difficulty: medium
Interview Round: Other
How would you identify the distribution of data from a sample, generalize it to the population, and find the confidence interval?
```hint Look before you test
Think about which plot compares a sample's shape with a candidate distribution more directly than a histogram does.
```
```hint Interval for what
Decide which population quantity the interval is for, and whether its estimator's sampling distribution depends on the family you picked.
```
### Clarifying Questions to Ask
- Which population quantity do we need an interval for: the mean, a median or percentile, or a model parameter?
- How was the sample collected, and is it a random sample of the population we care about?
- How large is the sample, and are the observations independent (one row per user, or repeated rows per user)?
### What a Strong Answer Covers
- Exploring the sample's shape and choosing candidate families, with a plot that compares the data against a candidate directly
- Fitting parameters and judging the fit, including what goodness-of-fit tests can and cannot tell you at small and large sample sizes
- What has to be true about the sampling process for the results to carry over to the population
- Building the interval for a clearly named quantity, with a parametric method and a distribution-free fallback (CLT or bootstrap)
- How a wrong distributional assumption distorts the interval
### Follow-up Questions
- With 2 million rows, a normality test rejects almost any real data. How do you decide whether a fit is good enough?
- You fit a lognormal to session lengths. How do you get a confidence interval for the mean session length, and how does it differ from one for the median?
- When can a bootstrap interval be misleading?
- The sample came from users who answered a survey email. What changes about generalizing to all users?
Overview: Asks how to work out which distribution a sample follows, carry that to the population, and build a confidence interval. Tests distribution fitting and diagnostics, the limits of goodness-of-fit tests, sampling assumptions, and parametric versus bootstrap intervals.