Perform student t-test on 3D matrix (on each grid point)
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi I have a 3D matrix (x,y,z) and I need to perform a t-test at each grid point (x,y) to test if the mean of the values in the z direction is significantly higher than zero.
My attempt:
A=data(306,6,63); %data
for x=1:306
for y=1:6
h(x,y)=ttest(A(x,y,:),'Alpha',0.01,'Tail','right'):
end
end
I wasn't sure how to handle the z direction in the loop. I've played around this this a lot getting various errors, right now it says "The data in a paired t-test must be the same size". I want to do a one-sample test on each grid point to get a 2D output indicating which grid points are significantly different.
0 Commenti
Risposta accettata
the cyclist
il 1 Set 2013
It's just a minor syntax error. Try
h(x,y)=ttest(A(x,y,:),[],'Alpha',0.01,'Tail','right');
Notice that I put in an empty array for the second argument.
(This was not particularly clear, in my opinion, from the documentation.)
3 Commenti
the cyclist
il 1 Set 2013
Since I did not have your data, this is the code I ran:
A = randn(306,6,63);
for x=1:306
for y=1:6
h(x,y)=ttest(A(x,y,:),[],'Alpha',0.01,'Tail','right');
end
end
Does that work for you?
If not, it could be a versioning issue. I have R2013a on Mac OS X 10.8.4.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!