When comparing two models by having a user choose between their outputs in a blind test, determining how many trials you need to achieve a statistically significant result involves some statistical considerations. Here's how you can estimate the number of trials needed to have decent confidence in your results.
Key Factors to Consider
-
Significance Level (α):
- This is the probability of rejecting the null hypothesis when it is actually true (a Type I error).
- Commonly set at 0.05 (5% significance level).
-
Statistical Power (1 - β):
- The probability of correctly rejecting the null hypothesis when the alternative hypothesis is true.
- A common target is 80% power, meaning you have an 80% chance of detecting a true effect.
-
Effect Size:
- The true difference in preference probability between the two models.
- Represents how much better one model is compared to the other (e.g., one model is preferred 70% of the time).
Estimating the Required Number of Trials
Since each trial results in a binary outcome (the user prefers either Model A or Model B), you can model this using the binomial distribution. Under the null hypothesis, the probability of the user preferring either model is 0.5. You want to determine the number of trials (n) needed to detect a difference from this probability with acceptable confidence and power.
Sample Size Formula for Binomial Test
The approximate sample size (n) for comparing a proportion to a known value (0.5 in this case) is given by:
[
n = \left( \frac{Z_{\alpha} \sqrt{2 p_0 (1 - p_0)} + Z_{\beta} \sqrt{p_1 (1 - p_1) + p_0 (1 - p_0)}}{p_1 - p_0} \right)^2
]
Where:
- ( Z_{\alpha} ) = Z-score corresponding to the desired significance level (e.g., 1.96 for α = 0.05 in a two-sided test).
- ( Z_{\beta} ) = Z-score corresponding to the desired power (e.g., 0.84 for 80% power).
- ( p_0 ) = Probability under the null hypothesis (0.5).
- ( p_1 ) = Expected probability under the alternative hypothesis (e.g., 0.7 if you expect one model to be preferred 70% of the time).
Example Calculation
Let's say you expect that one model will be preferred 65% of the time (( p_1 = 0.65 )), and you desire a significance level of 0.05 and a power of 80%.
-
Find Z-scores:
- For α = 0.05 (two-sided test), ( Z_{\alpha} = 1.96 ).
- For 80% power, ( Z_{\beta} = 0.84 ).
-
Calculate the Numerator:
[
\text{Numerator} = Z_{\alpha} \sqrt{2 p_0 (1 - p_0)} + Z_{\beta} \sqrt{p_1 (1 - p_1) + p_0 (1 - p_0)}
]
[
= 1.96 \sqrt{2 \times 0.5 \times 0.5} + 0.84 \sqrt{0.65 \times 0.35 + 0.5 \times 0.5}
]
[
= 1.96 \sqrt{0.5} + 0.84 \sqrt{0.2275 + 0.25}
]
[
= 1.96 \times 0.7071 + 0.84 \times \sqrt{0.4775}
]
[
= 1.3859 + 0.84 \times 0.6909 = 1.3859 + 0.5804 = 1.9663
]
- Calculate the Denominator:
[
p_1 - p_0 = 0.65 - 0.5 = 0.15
]
- Calculate n:
[
n = \left( \frac{1.9663}{0.15} \right)^2 = \left(13.1087 \right)^2 \approx 171.84
]
So, you would need approximately 172 trials to detect a preference probability of 0.65 with 80% power at the 5% significance level.
Adjusting for Expected Effect Size
- Smaller Effect Size: If the expected preference is closer to 0.5 (e.g., 55%), you will need more trials to detect this small difference.
- Larger Effect Size: If you expect a strong preference (e.g., 75%), fewer trials are needed.
Practical Recommendations
- For Moderate Effect Sizes (e.g., 65%-70%):
- Plan for at least 150-200 trials to achieve decent confidence.
- For Large Effect Sizes (e.g., 80% preference):
- 50-100 trials may be sufficient.
- For Small Effect Sizes (e.g., 55%-60%):
- 200+ trials may be necessary.
Considerations
-
Independence of Trials:
- Ensure each trial is independent. Randomize the order and context to minimize biases.
- Be cautious of fatigue effects if the same user is performing many trials in one sitting.
-
Multiple Users:
- While your question focuses on a single user, involving multiple users can strengthen the validity of your results.
- Aggregating data across users can improve the generalizability of your findings.
-
Practical Constraints:
- Balance statistical needs with practical limitations (time, user fatigue).
- If resources are limited, collect as much data as feasible and interpret results cautiously.
Summary
- Aim for 150-200 trials per user to achieve decent confidence in detecting moderate differences in preference.
- Adjust the number of trials based on your expected effect size and the resources available.
- Ensure trial independence and consider testing with multiple users if possible.
Final Note
Statistical calculations provide estimates, but practical experimentation is vital. Monitoring the results as you collect data can help you decide if additional trials are necessary. Always interpret your findings within the context of your experimental design and the assumptions underlying your statistical tests.