View source: R/chisq.bin.exp.R
chisq.bin.exp | R Documentation |
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.
chisq.bin.exp(formula, data, p, graph = FALSE)
formula |
a formula of the form |
data |
an optional data frame containing the variables in the formula |
p |
theoretical probabilities. |
graph |
logical. If |
The function returns how many counts can be < 5 to respect Cochran's rule (80% of counts must be >= 5).
p.theo |
theoretical probabilities. |
mat |
contingency table of expected counts. |
cochran |
number of counts which can be < 5. |
Maxime HERVE <maxime.herve@univ-rennes1.fr>
prop.test
, chisq.theo.bintest
, mosaicplot
response <- c(rep(0:1,c(40,60)),rep(0:1,c(55,45)),rep(0:1,c(65,35)))
fact <- gl(3,100,labels=LETTERS[1:3])
p.theo <- c(0.5,0.45,0.2)
chisq.bin.exp(response~fact,p=p.theo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.