Dimitri Liakhovitski
2011-Feb-10 20:43 UTC
[R] Chi square test of proprotions in 2 groups of different sizes
Hello!
Very sorry for a probably very simple question - I looked but did not
find an answer in the archives.
I have a table "counts" (below) that shows counts by Option within
each of my 2 groups. However, my groups have different sizes (N1=255
and N2=68). Table "prop" shows the resulting proportions within each
group.
I would like to compare the proportions in 2 groups using Chi Square
test. However, I am not sure how to do it because chisq.test(counts)
does not take into account the fact that the sizes of the groups are
different.
Any hint is greatly appreciated.
Thank you!
Dimitri
G1counts <- matrix(c(54,76,125), ncol = 1)
G2counts <- matrix(c(14,19,35), ncol = 1)
counts<-cbind(G1counts,G2counts)
colnames(counts)<-c("Group1","Group2");
rownames(counts)<-c("Option1","Option2","Option3")
N1=255
N2=68
Ns=c(N1,N2)
prop1<-G1counts/N1
prop2<-G2counts/N2
prop<-cbind(prop1,prop2)
colnames(prop)<-c("Group1","Group2");
rownames(prop)<-c("Option1","Option2","Option3")
(Ns);(counts);(prop);sum(prop)
Maybe Matching Threads
- [LLVMdev] CommandLine: using cl::Positional with enum
- [LLVMdev] CommandLine: using cl::Positional with enum
- [LLVMdev] CommandLine: using cl::Positional with enum
- [LLVMdev] CommandLine: using cl::Positional with enum
- [LLVMdev] CommandLine: using cl::Positional with enum
