Learn R Programming

LW1949 (version 1.1.0)

LWchi2: 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 obsn.
totn
A numeric vector of total counts possible, the same length as obsn.

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.

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).

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. http://jpet.aspetjournals.org/content/96/2/99.abstract.

See Also

chisq.test.

Examples

Run this code
LWchi2(c(10, 8, 3), c(7, 7, 7), c(12, 12, 12))

Run the code above in your browser using DataLab