How to perform Bonferroni correction on ttest2 comparison of two independent samples?
Hi all!
My question may be simple but I don’t get to perform Bonferroni correction on ttest2 comparison of two random independent samples with equal column number but different row number.
I want to perform ttest2 comparison between each column of my two samples, therefore getting 10 p-values (see example below). But i get the following error "Index in position 1 is invalid. Array indices must be positive integers or logical values".
Once I overcome this error, I would like to perform Bonferroni correction on ttest2 comparison.
So many thanks!!! I’m using Matlab R2022b
% Note that r1 and r2 differ in row number, not column number
r1 = randi(125,200,10); % Random sample 1
r2 = randi(155,100,10); % Random sample 2
% Perform ttest2 comparison, getting 10-pvalues by comparing the 10 columns of r1 and r2
[h,p,ci,stats] = ttest2(r1(i,:),r2(i,:)); % ttest2 comparison of two random, independent samples
results = multcompare(stats,"CriticalValueType","bonferroni") % Bonferroni correction on ttest2Hi all!
My question may be simple but I don’t get to perform Bonferroni correction on ttest2 comparison of two random independent samples with equal column number but different row number.
I want to perform ttest2 comparison between each column of my two samples, therefore getting 10 p-values (see example below). But i get the following error "Index in position 1 is invalid. Array indices must be positive integers or logical values".
Once I overcome this error, I would like to perform Bonferroni correction on ttest2 comparison.
So many thanks!!! I’m using Matlab R2022b
% Note that r1 and r2 differ in row number, not column number
r1 = randi(125,200,10); % Random sample 1
r2 = randi(155,100,10); % Random sample 2
% Perform ttest2 comparison, getting 10-pvalues by comparing the 10 columns of r1 and r2
[h,p,ci,stats] = ttest2(r1(i,:),r2(i,:)); % ttest2 comparison of two random, independent samples
results = multcompare(stats,"CriticalValueType","bonferroni") % Bonferroni correction on ttest2 Hi all!
My question may be simple but I don’t get to perform Bonferroni correction on ttest2 comparison of two random independent samples with equal column number but different row number.
I want to perform ttest2 comparison between each column of my two samples, therefore getting 10 p-values (see example below). But i get the following error "Index in position 1 is invalid. Array indices must be positive integers or logical values".
Once I overcome this error, I would like to perform Bonferroni correction on ttest2 comparison.
So many thanks!!! I’m using Matlab R2022b
% Note that r1 and r2 differ in row number, not column number
r1 = randi(125,200,10); % Random sample 1
r2 = randi(155,100,10); % Random sample 2
% Perform ttest2 comparison, getting 10-pvalues by comparing the 10 columns of r1 and r2
[h,p,ci,stats] = ttest2(r1(i,:),r2(i,:)); % ttest2 comparison of two random, independent samples
results = multcompare(stats,"CriticalValueType","bonferroni") % Bonferroni correction on ttest2 multcompare, bonferroni, ttest2, two independent samples MATLAB Answers — New Questions