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

View source: R/chisq.exp.R

chisq.expR Documentation

Expected counts for comparison of proportions to given values

Description

Returns expected counts before comparing proportions to given values by a chi-squared 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.

Details

The function returns how many counts can be < 5 to respect Cochran's rule (80% of counts must be >= 5).

Value

p.theo

theoretical proportions.

mat

contingency table of expected counts.

cochran

number of counts which can be < 5.

Author(s)

Maxime HERVE <maxime.herve@univ-rennes1.fr>

See Also

prop.test, chisq.test, mosaicplot

Examples

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)

RVAideMemoire documentation built on Nov. 6, 2023, 5:07 p.m.