chisq.theo.bintest: Pearson's Chi-squared test for comparison of response probabilities to given values
Description
Performs a Pearson's Chi-squared test for comparing response probabilities (i.e. when the response variable is a binary variable) to given values. 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.theo.bintest(formula, data, p)
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.
Value
method.testa character string giving the name of the test.
data.namea character string giving the name(s) of the data.
alternativea character string describing the alternative hypothesis, always two-sided.
estimatethe estimated probabilities.
null.valuethe theoretical probabilities.
statistictest statistics.
parametertest degrees of freedom.
p.valuep-value of the test.
Details
If the response is a 0/1 variable, the probability of the '1' group is tested. In any other cases, the response is transformed into a factor and the probability of the second level is tested.