← Roblox Interview Insights

Roblox·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Roblox data scientist interview with a stats coding question. Pretty focused on implementation details, not just theory.

Questions Asked (1)

Q1

Write a Python function that computes a p-value given a test statistic, a choice of distribution (Z or t), degrees of freedom, and a one-sided or two-sided alternative hypothesis.

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

I knew the formula but fumbled the two-sided case for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the function signature and edge cases, then implement using scipy.stats for reliability. Explain the logic for one-sided vs two-sided p-values and how the distribution choice affects the calculation.

Pro tip: Mention that in practice, you'd use scipy.stats rather than implementing the CDF yourself, but be prepared to explain the underlying math (e.g., using the survival function for numerical stability).

1. Clarify requirements and edge cases

Confirm input types, handle invalid inputs (e.g., negative degrees of freedom), and discuss one-sided vs two-sided definitions.

2. Choose the appropriate distribution

Use scipy.stats.norm for Z and scipy.stats.t for t-distribution, leveraging their CDF methods.

3. Compute the p-value based on alternative hypothesis

For one-sided, use the CDF or survival function depending on the direction; for two-sided, double the one-sided p-value or use the absolute statistic.

4. Implement the function with clear parameterization

Write a Python function that takes test_statistic, distribution, df, and alternative, and returns the p-value.

5. Test and validate

Run unit tests with known values (e.g., z=1.96, two-sided p≈0.05) to ensure correctness.

Key Points to Mention

  • Difference between one-sided and two-sided p-values and how to compute each.
  • Use of scipy.stats.norm and scipy.stats.t for CDF calculations.
  • Handling of degrees of freedom for t-distribution (required parameter).
  • Edge cases: invalid inputs, extreme test statistics, and numerical stability.
  • Interpretation of p-value in the context of A/B testing.
  • Potential for using survival function (sf) for better numerical precision.

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