LWchi2 {LW1949} | R Documentation |
Chi-Squared Statistic
Description
Calculate the chi-squared statistic from observed and expected counts using the Litchfield and Wilcoxon (1949) approach.
Usage
LWchi2(obsn, expn, totn)
Arguments
obsn |
A numeric vector of observed counts. |
expn |
A numeric vector of expected counts, the same length as |
totn |
A numeric vector of total counts possible, the same length as |
Details
The denominator of Litchfield and Wilcoxon's (1949) chi-squared estimate
is the minimum of the expn
and (totn
- expn
)
following their Nomograph No. 1. This ensures that the same chi-squared
value is calculated regardless of which proportion is reported (e.g.,
affected vs. not affected).
Value
A list of length two.
The first element is a numeric vector of length three:
chistat
, chi-squared statistic;
df
, degrees of freedom; and
pval
, P value.
The second element is a numeric vector the same length as obsn
,
containing total contributions to the chi-squared. To get the
individual contributions to the chi-squared as reported in
Litchfield and Wilcoxon (1949), divide by totn
.
References
Litchfield, JT Jr. and F Wilcoxon. 1949. A simplified method of evaluating dose-effect experiments. Journal of Pharmacology and Experimental Therapeutics 96(2):99-113. [link].
See Also
Examples
LWchi2(c(10, 8, 3), c(7, 7, 7), c(12, 12, 12))