Two one sided test (TOST) for equivalence

版本 1.0.0 (2.1 KB) 作者: PabiG
Statistical test for equivalence within effect bounds
30.0 次下载
更新时间 2023/2/10

查看许可证

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;

引用格式

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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2022b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0