Miloš Žarković
2021-Oct-16 15:51 UTC
[R] Chi-square test: Specifying expected proportions for two way table
Hi, Is there a function where I can specify expected proportions for the two-way table to calculate the Chi-square test? chisq.test allows specifying only the one-way table. Otherwise, I will have to write the function, but I never trust myself not to make a mess programing. Thanks, Milo? Milo? ?arkovi? Professor of Internal Medicine School of Medicine, University of Belgrade Clinic of Endocrinology, Clinical Centre of Serbia 11000 Belgrade PAK 112113 Serbia Phone +381 11 3639 724 email milos.zarkovic at med.bg.ac.rs milos.zarkovic at gmail.com [[alternative HTML version deleted]]
Bert Gunter
2021-Oct-16 16:12 UTC
[R] Chi-square test: Specifying expected proportions for two way table
Perhaps I misunderstand, but ?chisq.test explicitly says: "If x is a matrix with at least two rows and columns, it is taken as a two-dimensional contingency table: the entries of x must be non-negative integers. Otherwise, x and y must be vectors or factors of the same length; cases with missing values are removed, the objects are coerced to factors, and the contingency table is computed from these. Then Pearson's chi-squared test is performed of the null hypothesis that the joint distribution of the cell counts in a 2-dimensional contingency table is the product of the row and column marginals." Moreover, expected counts are one component of the returned result (see the "value" section). Proportions can of course easily then be obtained if so desired. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Oct 16, 2021 at 8:52 AM Milo? ?arkovi? <milos.zarkovic at gmail.com> wrote:> > Hi, > > Is there a function where I can specify expected proportions for the > two-way table to > calculate the Chi-square test? chisq.test allows specifying only the > one-way table. > Otherwise, I will have to write the function, but I never trust myself not > to make a mess > programing. > > Thanks, > > Milo? > > Milo? ?arkovi? > Professor of Internal Medicine > School of Medicine, University of Belgrade > Clinic of Endocrinology, Clinical Centre of Serbia > 11000 Belgrade > PAK 112113 > Serbia > Phone +381 11 3639 724 > email milos.zarkovic at med.bg.ac.rs > milos.zarkovic at gmail.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.