rateratio.test {rateratio.test}R Documentation

An Exact Rate Ratio Test Assuming Poisson Counts

Description

Performs the uniformy most powerful unbiased test on the ratio of rates of two Poisson counts with given time (e.g., perons-years) at risk for each count.

Usage

rateratio.test(x, n, RR = 1, alternative = c("two.sided", "less", "greater"), conf.level = 0.95)

Arguments

x a vector of length 2 with counts for the two rates
n a vector of length 2 with time at risk in each rate
RR the null rate ratio (two.sided) or the rate ratio on boundary between null and alternative
alternative a character string specifying the alternative hypothesis, must be one of '"two.sided"' (default), '"greater"' or '"less"'. You can specify just the initial letter.
conf.level confidence level of the returned confidence interval. Must be a single number between 0 and 1.

Details

The rateratio.test tests whether the ratio of the first rate (estimated by x[1]/n[1]) over the second rate (estimated by x[2]/n[2]) is either equal to, less, or greater than RR. Exact confidence intervals come directly from binom.test. The two-sided p-value is defined as either 1 or twice the minimum of the one-sided p-values. See Lehmann (1986, p. 152) or vignette("rateratio.test").

Value

An object of class `htest' containing the following components:

p.value the p-value of the test
estimate a vector with the rate ratio and the two individual rates
null.value the null rate ratio (two.sided) or the rate ratio on boundary between null and alternative
conf.int confidence interval
alternative type of alternative hypothesis
method description of method
data.name description of data

Note

Much of the error checking code was taken from prop.test.

Author(s)

Michael Fay

References

Lehmann, E.L. (1986). Testing Statistical Hypotheses (second edition). Wadsworth and Brooks/Cole, Pacific Grove, California.

See Also

prop.test, binom.test

Examples

### p values and confidence intervals are defined the same way
### so there is consistency in inferences
rateratio.test(c(2,9),c(17877,16660))
### Small counts and large time values will give results similar to Fisher's exact test 
### since in that case the rate ratio is  approximately equal to the odds ratio 
### However, for the Fisher's exact test, the two-sided p-value is defined differently from 
###  the way the confidence intervals are defined and may imply different inferences
### i.e., p-value may say reject OR=1, but confidence interval says not to reject OR=1
fisher.test(matrix(c(2,9,17877-2,16660-9),2,2))

[Package rateratio.test version 1.0 Index]