chisquare vector different length

321 Views Asked by At

I have 3 data vectors representing the gender (0=male, 1=female) of 3 groups A,B,C.

for example

A = [0 0 0 0 1 1 1 1 0 0];
B = [1 1 1 1 1 1 1 0];
C = [1 0 0 1 0 1 1 0 1 1 1 1 1];

and relative number of male and female

n_maleA =6;
n_femaleA =4;
n_maleB = 1;
n_femaleB = 7;
n_maleC = 4;
n_femaleC = 9;

I would like to know if there are significant differences in gender between the 3 groups. To do this I read that is possible to use

   [tbl,chi2stat,pval] = crosstab(x1,x2)

How can I use this with more than 2 groups of data and with data that have different length? Is there any other way to perform the chi-squared test in matlab that suits with my case? Thanks in advance

0

There are 0 best solutions below