필터 지우기
필터 지우기

t test ( not sure if my implementation is correct)

조회 수: 2 (최근 30일)
Alexander Guillen
Alexander Guillen 2023년 2월 28일
댓글: Alexander Guillen 2023년 2월 28일
Suppose that I have two groups, N and R. Each group contains four columns which represent different subjects. For example (hypothetically):
N1 = [1:5]' .... N4 = [1:5]' so that N = { N1,N2,N3,N4}
R1 = [1:5]'.... R4 = [1:5]' so that R = {R1...R4}
Is it possible to enable a loop which which can perform the t-test so that I can avoid this manually:
h = ttest(N1,R1);
.
.
.
h = ttest(N1,R4);
---
h = ttest(N2,R1);
.
.
.
h = ttest(N2,R4); and so on
I understand it may be wrong my implementation of the t-test. But I would like to put into a loop what I just described. Any guidance and help will be appreciated.

채택된 답변

David Hill
David Hill 2023년 2월 28일
N=randi(100,5,4);%your matrix;
R=randi(100,5,4);%your matrix
h=1;
for n=1:4
for r=1:4
H(h)=ttest(N(:,n),R(:,r));
h=h+1;
end
end
H
H = 1×16
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
  댓글 수: 2
Alexander Guillen
Alexander Guillen 2023년 2월 28일
wow thank you
Alexander Guillen
Alexander Guillen 2023년 2월 28일
By any chance, do you know how I can display the columns from N and R which h = 1?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by