The Farrington-Manning test for rate differences can be used to compare the rate difference of successes between two groups to a preset value. It uses an explicit formula for the standard deviation of the test statistic under the null hypothesis [1].
Arguments
- group1
a logical vector of data from group 1, where
TRUE
indicates a success- group2
a logical vector of data from group 2, where
TRUE
indicates a success- delta
the rate difference under the null hypothesis
- alternative
character string indicating the alternative to use, either of "two.sided", "less", "greater"
- alpha
the significance level (acceptable error of the first kind), a two-sided confidence intnerval is returned with confidence level 1 - 2*alpha, such that the lower bound is a valid one sided confidence interval at the confidence level 1 - alpha.
Value
A list of class "htest" containing the following components:
statistic : | the value of the Z-statistic |
parameter : | delta, rate difference (group 1 - group 2) under the null hypothesis |
p.value : | the p-value for the Farrington-Manning test |
null.value : | rate difference (group 1 - group 2) under the null |
alternative : | a character string indicating the alternative hypothesis |
method : | a character string indicating the exact method employed |
data.name : | a character string giving the names of the data used |
estimate : | the estimated rate difference (maximum likelihood) |
conf.int : | a confidence interval for the rate difference |
sample.size : | the total sample size used for the test |
Details
The Farrington-Maning test for rate differences test the null hypothesis of $$H_{0}: p_{1} - p_{2} = \delta$$ for the "two.sided" alternative (or \(\geq\) for the "greater" respectively \(\leq\) for the "less" alternative). This formulation allows to specify non-inferiority and superiority test in a consistent manner:
- non-inferiority
for delta < 0 and alternative == "greater" the null hypothesis reads \(H_{0}: p_{1} - p_{2} \geq \delta\) and consequently rejection allows concluding that \(p_1 \geq p_2 + \delta\) i.e. that the rate of success in group one is at least the success rate in group two plus delta - as delta is negagtive this is equivalent to the success rate of group 1 being at worst |delta| smaller than that of group 2.
- superiority
for delta >= 0 and alternative == "greater" the null hypothesis reads \(H_{0}: p_{1} - p_{2} \geq \delta\) and consequently rejection allows concluding that \(p_1 \geq p_2 + \delta\) i.e. that the rate of success in group one is at least delta greater than the success rate in group two.
The confidence interval is always computed as two-sided, but with 1-2\(\alpha\) confidence level in case of a one-sided hypthesis. This means that the lower or upper vound are valid one-sided confidence bounds at level \(\alpha\) in this case. The confidence interval is constructed by inverting the two-sided test directly.
References
[1] Farrington, Conor P., and Godfrey Manning. "Test statistics and sample size formulae for comparative binomial trials with null hypothesis of non-zero risk difference or non-unity relative risk." Statistics in medicine 9.12 (1990): 1447-1454.
Examples
x <- c(rep(TRUE, 20), rep(FALSE, 15))
y <- c(rep(TRUE, 30), rep(FALSE, 25))
farrington.manning(x, y, -.3)
#>
#> Farrington-Manning test for non-inferiority of rates
#>
#> data: group 1: x, group 2: y
#> Z-statistic = 3.1546, noninferiority margin = -0.3, p-value = 0.0008037
#> alternative hypothesis: true rate difference (group 1 - group 2) is greater than -0.3
#> 95 percent confidence interval:
#> -0.1824742 0.2282376
#> sample estimates:
#> rate difference (group 1 - group 2)
#> 0.02597403
#>