Clear Filters
Clear Filters

paired ttest multiple groups loop?

2 views (last 30 days)
kcin
kcin on 20 Jan 2017
Basic matlab user so assume there is an easy fix for my query, nonetheless looking for assistance on automating paired ttest between as many groups as available. Completing ttest, grouping p value results with group identifiers for sigstar boxplot. How can I loop this so it completes it no matter how many groups and not requiring me to enter them manually? (the groups and group identifiers) Thankyou for any assistance
[zh1,zp1]=ttest(z1,z2);
[zh2,zp2]=ttest(z1,z3);
[zh3,zp3]=ttest(z1,z4);
[zh4,zp4]=ttest(z1,z5);
[zh5,zp5]=ttest(z2,z3);
[zh6,zp6]=ttest(z2,z4);
[zh7,zp7]=ttest(z2,z5);
[zh8,zp8]=ttest(z3,z4);
[zh9,zp9]=ttest(z3,z5);
[zh10,zp10]=ttest(z4,z5);
ZP=[zp1,zp2,zp3,zp4,zp5,zp6,zp7,zp8,zp9,zp10];
ZH={[1,2],[1,3],[1,4],[1,5],[2,3],[2,4],[2,5],[3,4],[3,5],[4,5]};
ZP(ZP>statvalue)=0;
ZPH=[num2cell(ZP);ZH];

Answers (0)

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!