Pretty mechanical once you remember the formula: n = ((z_alpha/2 + z_beta) * sigma / delta)^2, then ceiling it.
Start by stating the formula for sample size per group in a two-sided two-sample z-test: n = 2*(z_{1-α/2} + z_{1-β})^2 * σ^2 / Δ^2, where σ is the standard deviation and Δ is the minimum detectable effect. Then, if the historical sample provides a proportion or variance, plug in the appropriate values; otherwise, assume a reasonable estimate. Finally, round up to the nearest integer and mention that this is an approximation that assumes normality and known variance.
Pro tip: Always clarify whether the historical sample gives you a standard deviation or a proportion, and whether the metric is continuous or binary, because that changes the variance calculation. Also, mention that in practice you might use a t-test or adjust for unequal variances, but the z-test formula is a good starting point.
Determine the significance level (α), desired power (1-β), minimum detectable effect (Δ), and the standard deviation (σ) or proportion (p) from the historical sample.
For a two-sided two-sample z-test with equal group sizes, use n = 2*(z_{1-α/2} + z_{1-β})^2 * σ^2 / Δ^2. If the metric is binary, replace σ^2 with p(1-p).
Find the critical z-values for the given α and β from a standard normal table or using software (e.g., z_{0.975}=1.96 for α=0.05, z_{0.80}=0.84 for power=0.80).
Substitute the values into the formula and compute the required sample size per group. Round up to the next whole number.
Verify that the result makes sense (e.g., smaller MDE or higher power increases n). Explain any assumptions and note that this is an estimate; actual required sample size may vary due to factors like non-compliance or multiple testing.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
The basic DiD part was fine, just group-mean arithmetic.
Start by clarifying the data structure and the DiD design, then implement the estimator using a regression framework with interaction terms. For parallel trends validation, use pre-period data to test for differential trends, comparing the test statistic to the provided threshold. Finally, discuss assumptions and potential violations.
Pro tip: Emphasize that parallel trends is an assumption about counterfactual trends, not a testable hypothesis, but pre-period tests provide suggestive evidence. Also, mention that clustering standard errors at the group level is crucial for valid inference.
Confirm the treatment and control groups, pre- and post-periods, and the outcome variable. Discuss the canonical 2x2 DiD and how it extends to multiple periods.
Use a regression of outcome on group, period, and their interaction (or two-way fixed effects for multiple periods). The coefficient on the interaction is the DiD estimate.
With multiple pre-periods, test for differential pre-trends by regressing pre-period outcomes on group, period, and group×period interactions. Compare the joint significance (e.g., F-test) to the provided threshold.
If the test statistic exceeds the threshold, evidence against parallel trends; otherwise, proceed with caution. Discuss other threats like anticipation effects or compositional changes.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
State Bayes' theorem clearly, then plug in the given probabilities and compute the posterior step by step. Emphasize the intuition behind the update and relate it to a practical scenario like A/B testing or user behavior modeling at Roblox.
Pro tip: After computing the numerical answer, briefly discuss how you would validate the result (e.g., sanity checks, edge cases) and how this applies to real-world data science problems like measuring the impact of a new feature.
Write the formula P(A|B) = P(B|A) * P(A) / P(B), and note that P(B) = P(B|A)P(A) + P(B|not A)P(not A).
List P(A), P(B|A), and P(B|not A). Compute P(not A) = 1 - P(A).
Calculate the total probability of B using the law of total probability: P(B) = P(B|A)P(A) + P(B|not A)P(not A).
Substitute the values into the formula to compute P(A|B).
Explain what the result means in context, and perform a sanity check (e.g., posterior should be between 0 and 1, and if P(B|A) > P(B|not A), posterior > prior).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
The transposed input layout (features as rows) is a small gotcha, you need to pass X.T to the model.
First, clarify the data orientation: features are rows and observations are columns, so you need to transpose the data before fitting. Then fit a logistic regression model, extract the coefficients, take absolute values, sort descending, and break ties alphabetically. Finally, return the top 3 feature names.
Pro tip: Mention that in practice, you would standardize features before comparing coefficients, but for this specific question, follow the instructions exactly and note the assumption. Also, explicitly state how you handle ties to show attention to detail.
Confirm that the input matrix has features as rows and observations as columns. Transpose it so that rows are observations and columns are features, which is the standard format for scikit-learn.
Use a logistic regression implementation (e.g., sklearn.linear_model.LogisticRegression) to fit the model on the transposed data and the target labels.
Retrieve the model coefficients, take their absolute values, and pair each with its corresponding feature name.
Sort the features by absolute coefficient value in descending order. For ties, sort alphabetically by feature name. Return the top 3 feature names.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.