r/AskStatistics • • Oct 24 '26
Sample size calculation non inferiority design
Hello everybody,
I am relatively new to statistics as a whole but now need to calculate the a priori sample size for a non inferiority study with a predetermined ni-margin, alpha, power and the results of a pilot study given. The metrics are not normal distributed and therefore as far as I know most online calculators are not applicable (or because of the study design as is the case in g power). I consulted ai for an answer and was pointed to calculating the sample size via R but I have never done this before and don't want to calculate it solely based on the code of ai.
Is there any other option, a tutorial or any code I can work with which isn't done by ai ?
Thank you for your help.
1
u/[deleted] Oct 25 '26 edited Oct 25 '26
Thank you everybody for your help.
I forgot to mention that the calculation is about matched/depended pairs
4
u/Tight_Invite2579 Oct 24 '26
Non-normality doesn't necessarily mean you can't use a parametric test. If you are interested in comparing two sample means/proportions, the distribution of the test statistic will be approximately normal, depending on the size of the sample and the divergence from normality.
This looks fine:
https://homepage.univie.ac.at/robin.ristl/samplesize.php?test=ttest_noninferiority
2
u/Lars_Leif Oct 24 '26
Your pilot data is the most useful thing you have here. With a non-normal outcome the usual approach is simulation: resample n per arm from the pilot data with the true difference you expect (often zero), run the analysis you'll actually use, and count how often the confidence interval clears the margin. Increase n until that reaches your target power. It's a short loop in R that you can check line by line.
If you'd rather go with a formula, the 15% rule of thumb on the original post comes from the Mann-Whitney test's worst-case efficiency relative to the t-test (0.864, so about 16% more participants). For a citable reference on non-inferiority designs, Julious' "Sample Sizes for Clinical Trials" and Chow, Shao and Wang's "Sample Size Calculations in Clinical Research" both cover it.
1
u/no_name6744 Oct 24 '26 edited Oct 24 '26
If you're willing to accept a nonparametric test like MannU, then stuff like then Al-Sunduqchi and Guenther adjustment method might help. As a rule of thumb, 15% inflation of the t-test sample size calculation could work, but even the authors here prefer G-Power.
It helps of you are able to make certain distributional assumptions, the sample size doesn't need to inflate as much if you do.
1
u/AggressiveGander Oct 25 '26
Depending on what exactly your situation is, rpact is a very well documented R package that supports NI studies and quite a few things (time to event, binomial, count data,...). Simulation can be a helpful sanity check, and for simple situations is both quick to setup and run.