Two one sided test (TOST) for equivalence

Version 1.0.0 (2.13 KB) by PabiG
Statistical test for equivalence within effect bounds
33 Downloads
Updated 10 Feb 2023

View License

Statistical test for equivalence within effect bounds as described in:
Schuirmann, D. J. (1987). A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. Journal of pharmacokinetics and biopharmaceutics, 15, 657-680.
Example Code:
%%Example with x1~N(1,1) and x2~N(1.1, 1)
NoRange = [10^3, 10^4, 10^5, 10^6];
ColorInd = 0;
Colors{1} = [1 0 0];Colors{2} = [0 1 0];Colors{3} = [0 0 1] ;Colors{4} = [1 1 0] ;
figure
for No =NoRange
ColorInd = ColorInd +1;
mu1 = 1;
mu2 = 1.1;
sigma1 = 1;
sigma2 = 1; %for simplicity
x1 = normrnd(mu1,sigma1, 1,No);
x2 = normrnd(mu2,sigma2, 1,No);
alpha = 0.03;
range = 0.01:0.001:0.2;
AllP = zeros(1,length(range));
ind = 0;
for min_effectsize = range
ind = ind +1;
[TestResult, p] = TOST(x1, x2, min_effectsize);
AllP(ind) = max(p);
end
hold on
plot(range, AllP, '*', 'Color', Colors{ColorInd})
end
hold on
line([abs(mu1-mu2)/((sigma1 + sigma2)/2) abs(mu1-mu2)/((sigma1 + sigma2)/2)], [0 1])
ylabel('p-Value')
xlabel('Minimal Effect Size')
legend('Sample: 10^3', 'Sample: 10^4', 'Sample: 10^5', 'Sample: 10^6', '(\mu_1-\mu_2)/\sigma')
ax = gca;
ax.FontSize = 16;

Cite As

PabiG (2024). Two one sided test (TOST) for equivalence (https://www.mathworks.com/matlabcentral/fileexchange/124560-two-one-sided-test-tost-for-equivalence), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0