chisq.bin.exp: Expected counts for comparison of response probabilities to given values
Description
Returns expected counts before comparing response probabilities (i.e. when the response variable is a binary variable) to given values by a chi-squared test. The function is in fact a wrapper to the chi-squared test for comparison of proportions to given values on a contingency table.
Usage
chisq.bin.exp(formula, data, p, graph = FALSE)
Value
p.theo
theoretical probabilities.
mat
contingency table of expected counts.
cochran
number of counts which can be < 5.
Arguments
formula
a formula of the form a ~ b, where a and b give the data values and corresponding groups, respectively. a can be a numeric vector or a factor, with only two possible values (except NA).
data
an optional data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
p
theoretical probabilities.
graph
logical. If TRUE a mosaic plot of expected counts is drawn.
Author
Maxime HERVE <maxime.herve@univ-rennes1.fr>
Details
The function returns how many counts can be < 5 to respect Cochran's rule (80% of counts must be >= 5).