필터 지우기
필터 지우기

Chi square test: non parametric

조회 수: 16 (최근 30일)
Cside
Cside 2020년 10월 6일
댓글: Cside 2020년 10월 9일
Hi, I have 3 groups of categorical data (all logicals) and would like to run the chi square test to get the p-value. However, these 3 groups are of unequal sample sizes. Which chi square function would be recommended for me to use - one that does not require me to key in the degree of freedom and returns me the p-value and chi square value?
Thank you so much!

채택된 답변

Jeff Miller
Jeff Miller 2020년 10월 6일
It sounds like this is what you want:
% Create some fake data to use as an example,
% with 3 groups of different sizes;
score1 = randi(2,44,1) - 1; % 1 = true, 0 = false
score2 = randi(2,66,1) - 1;
score3 = randi(2,77,1) - 1;
% Make some vectors to code the groups
cod1 = 0*score1 + 1;
cod2 = 0*score2 + 2;
cod3 = 0*score3 + 3;
codes = [cod1; cod2; cod3];
scores = [score1; score2; score3];
[t, chisq, p] = crosstab(codes,scores)
  댓글 수: 1
Cside
Cside 2020년 10월 9일
great! this was exactly what I was looking for, thank you Jeff :)

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by