← Roblox Interview Insights

Roblox·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Got a stats/coding question for a Data Scientist role at Roblox that was pretty much entirely about A/B test sample size math. One question, clean setup, but the edge cases are where it gets interesting.

Questions Asked (1)

Q1

Write a function that takes a baseline array of metric values, a significance level, a desired power, and a minimum detectable effect, then returns the minimum total sample size needed for a two-sample z-test with equal group sizes.

A/B Testing & ExperimentationAlgorithms & Data Structures
Author's notes

The formula itself isn't hard once you remember it: n per group = ((z_alpha/2 + z_beta)^2 * 2 * sigma^2) / delta^2, then double it and ceil.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the assumptions: two-sample z-test, equal group sizes, and known variance estimated from the baseline array. Derive the sample size formula using the standard normal quantiles for the significance level and power, then compute the required total sample size as twice the per-group size, rounding up to the nearest integer.

Pro tip: Mention that in practice, you'd use the baseline variance but also consider using a pooled variance or a more robust method if the metric is skewed; also note that the formula assumes independent observations and no peeking, which is critical for valid A/B tests.

1. Clarify inputs and assumptions

Confirm that the baseline array provides the variance (or standard deviation) of the metric, and that the test is two-sided with equal group sizes. State that the z-test assumes known variance and normally distributed data (or large samples).

2. Derive the sample size formula

Use the standard formula for two-sample z-test: n per group = ( (z_{1-α/2} + z_{1-β})^2 * (σ_1^2 + σ_2^2) ) / Δ^2, where σ_1^2 = σ_2^2 = variance from baseline, and Δ is the minimum detectable effect. Total sample size = 2 * n per group.

3. Compute quantiles and plug in values

Calculate the z-scores for the given significance level (α) and power (1-β) using the inverse normal CDF. Compute the variance from the baseline array, then substitute into the formula.

4. Round up and return total sample size

Since sample size must be an integer, round up the per-group size to the nearest whole number, then double it to get the total sample size. Return that integer.

5. Validate and discuss practical considerations

Mention that this is a simplified calculation; in practice, you might adjust for unequal group sizes, use t-test for small samples, or account for multiple testing. Also note that the baseline variance might be estimated from historical data.

Key Points to Mention

  • Two-sample z-test formula for sample size with equal allocation
  • Use of standard normal quantiles for significance level and power
  • Variance estimation from the baseline array (assuming known variance)
  • Minimum detectable effect (MDE) as absolute difference in means
  • Rounding up to ensure sufficient power
  • Assumptions: independence, normality (or large sample), no peeking

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.