powered by
Returns expected counts before comparing proportions to given values by a chi-squared test.
chisq.exp(data, p, graph = FALSE)
theoretical proportions.
contingency table of expected counts.
number of counts which can be < 5.
contingency table.
logical. If TRUE a mosaic plot of expected counts is drawn.
TRUE
Maxime HERVE <maxime.herve@univ-rennes1.fr>
The function returns how many counts can be < 5 to respect Cochran's rule (80% of counts must be >= 5).
prop.test, chisq.test, mosaicplot
prop.test
chisq.test
mosaicplot
proportions <- sample(c(0,1),200,replace=TRUE) populations <- sample(LETTERS[1:3],200,replace=TRUE) tab.cont <- table(populations,proportions) p.theo <- c(0.4,0.5,0.7) chisq.exp(tab.cont,p=p.theo)
Run the code above in your browser using DataLab