Learn R Programming

RVAideMemoire (version 0.9-6)

chisq.exp: Expected counts for comparison of proportions to theoretical values

Description

Return expected counts before comparing proportions to theoretical values by chi2 test.

Usage

chisq.exp(data, p, graph = FALSE)

Arguments

data
contingency table.
p
theoretical proportions.
graph
logical. If TRUE a mosaic plot of expected counts is drawn.

Value

  • p.theotheoretical proportions.
  • matcontingency table of expected counts.
  • cochrannumber of counts which can be inferior or egal to 5.

Details

The function returns how many counts can be inferior or egal to 5 to respect Cochran's rule (80 % of counts must be inferior or egal to 5).

See Also

prop.test, chisq.test, mosaicplot

Examples

Run this code
proportions<-sample(c(0,1),60,replace=TRUE)
populations<-sample(LETTERS[1:3],60,replace=TRUE)
tab.cont<-table(populations,proportions)
p.theo<-c(0.2,0.5,0.7)
chisq.exp(tab.cont,p=p.theo)

Run the code above in your browser using DataLab